Skip to content

Commit

Permalink
Merge pull request #11693 from rhatdan/cleanup
Browse files Browse the repository at this point in the history
standardize logrus messages to upper case
  • Loading branch information
openshift-merge-robot authored Sep 22, 2021
2 parents aa628b8 + 1c4e6d8 commit f2eb5bb
Show file tree
Hide file tree
Showing 82 changed files with 316 additions and 316 deletions.
8 changes: 4 additions & 4 deletions cmd/podman/containers/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func cleanup(cmd *cobra.Command, args []string) error {
// is via syslog.
// As such, we need to logrus.Errorf our errors to ensure they
// are properly printed if --syslog is set.
logrus.Errorf("Error running container cleanup: %v", err)
logrus.Errorf("Running container cleanup: %v", err)
return err
}
for _, r := range responses {
Expand All @@ -89,15 +89,15 @@ func cleanup(cmd *cobra.Command, args []string) error {
continue
}
if r.RmErr != nil {
logrus.Errorf("Error removing container: %v", r.RmErr)
logrus.Errorf("Removing container: %v", r.RmErr)
errs = append(errs, r.RmErr)
}
if r.RmiErr != nil {
logrus.Errorf("Error removing image: %v", r.RmiErr)
logrus.Errorf("Removing image: %v", r.RmiErr)
errs = append(errs, r.RmiErr)
}
if r.CleanErr != nil {
logrus.Errorf("Error cleaning up container: %v", r.CleanErr)
logrus.Errorf("Cleaning up container: %v", r.CleanErr)
errs = append(errs, r.CleanErr)
}
}
Expand Down
14 changes: 7 additions & 7 deletions cmd/podman/images/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func buildFlags(cmd *cobra.Command) {
// --pull flag
flag := budFlags.Lookup("pull")
if err := flag.Value.Set("true"); err != nil {
logrus.Errorf("unable to set --pull to true: %v", err)
logrus.Errorf("Unable to set --pull to true: %v", err)
}
flag.DefValue = "true"
flag.Usage = "Always attempt to pull the image (errors are fatal)"
Expand All @@ -148,21 +148,21 @@ func buildFlags(cmd *cobra.Command) {
useLayersVal := useLayers()
buildOpts.Layers = useLayersVal == "true"
if err := flag.Value.Set(useLayersVal); err != nil {
logrus.Errorf("unable to set --layers to %v: %v", useLayersVal, err)
logrus.Errorf("Unable to set --layers to %v: %v", useLayersVal, err)
}
flag.DefValue = useLayersVal
// --force-rm flag
flag = layerFlags.Lookup("force-rm")
if err := flag.Value.Set("true"); err != nil {
logrus.Errorf("unable to set --force-rm to true: %v", err)
logrus.Errorf("Unable to set --force-rm to true: %v", err)
}
flag.DefValue = "true"
flags.AddFlagSet(&layerFlags)

// FromAndBud flags
fromAndBudFlags, err := buildahCLI.GetFromAndBudFlags(&buildOpts.FromAndBudResults, &buildOpts.UserNSResults, &buildOpts.NameSpaceResults)
if err != nil {
logrus.Errorf("error setting up build flags: %v", err)
logrus.Errorf("Setting up build flags: %v", err)
os.Exit(1)
}
// --http-proxy flag
Expand All @@ -171,7 +171,7 @@ func buildFlags(cmd *cobra.Command) {
flag = fromAndBudFlags.Lookup("http-proxy")
buildOpts.HTTPProxy = false
if err := flag.Value.Set("false"); err != nil {
logrus.Errorf("unable to set --https-proxy to %v: %v", false, err)
logrus.Errorf("Unable to set --https-proxy to %v: %v", false, err)
}
flag.DefValue = "false"
}
Expand All @@ -184,7 +184,7 @@ func buildFlags(cmd *cobra.Command) {
flag = flags.Lookup("isolation")
buildOpts.Isolation = buildahDefine.OCI
if err := flag.Value.Set(buildahDefine.OCI); err != nil {
logrus.Errorf("unable to set --isolation to %v: %v", buildahDefine.OCI, err)
logrus.Errorf("Unable to set --isolation to %v: %v", buildahDefine.OCI, err)
}
flag.DefValue = buildahDefine.OCI
_ = flags.MarkHidden("disable-content-trust")
Expand Down Expand Up @@ -228,7 +228,7 @@ func build(cmd *cobra.Command, args []string) error {
// Delete it later.
defer func() {
if err = os.RemoveAll(tempDir); err != nil {
logrus.Errorf("error removing temporary directory %q: %v", contextDir, err)
logrus.Errorf("Removing temporary directory %q: %v", contextDir, err)
}
}()
contextDir = filepath.Join(tempDir, subDir)
Expand Down
4 changes: 2 additions & 2 deletions cmd/podman/images/utils_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func setupPipe() (string, func() <-chan error, error) {
err = unix.Mkfifo(pipePath, 0600)
if err != nil {
if e := os.RemoveAll(pipeDir); e != nil {
logrus.Errorf("error removing named pipe: %q", e)
logrus.Errorf("Removing named pipe: %q", e)
}
return "", nil, errors.Wrapf(err, "error creating named pipe")
}
Expand All @@ -40,7 +40,7 @@ func setupPipe() (string, func() <-chan error, error) {
}()
return pipePath, func() <-chan error {
if e := os.RemoveAll(pipeDir); e != nil {
logrus.Errorf("error removing named pipe: %q", e)
logrus.Errorf("Removing named pipe: %q", e)
}
return errc
}, nil
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/inspect/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func (i *inspector) inspect(namesOrIDs []string) error {
err = printTmpl(tmpType, row, data)
}
if err != nil {
logrus.Errorf("Error printing inspect output: %v", err)
logrus.Errorf("Printing inspect output: %v", err)
}

if len(errs) > 0 {
Expand Down
6 changes: 3 additions & 3 deletions cmd/podman/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error {
// Hard code TMPDIR functions to use /var/tmp, if user did not override
if _, ok := os.LookupEnv("TMPDIR"); !ok {
if tmpdir, err := cfg.ImageCopyTmpDir(); err != nil {
logrus.Warnf("failed to retrieve default tmp dir: %s", err.Error())
logrus.Warnf("Failed to retrieve default tmp dir: %s", err.Error())
} else {
os.Setenv("TMPDIR", tmpdir)
}
Expand Down Expand Up @@ -313,7 +313,7 @@ func rootFlags(cmd *cobra.Command, opts *entities.PodmanConfig) {
pFlags := cmd.PersistentFlags()
if registry.IsRemote() {
if err := lFlags.MarkHidden("remote"); err != nil {
logrus.Warnf("unable to mark --remote flag as hidden: %s", err.Error())
logrus.Warnf("Unable to mark --remote flag as hidden: %s", err.Error())
}
opts.Remote = true
} else {
Expand Down Expand Up @@ -387,7 +387,7 @@ func rootFlags(cmd *cobra.Command, opts *entities.PodmanConfig) {
"trace",
} {
if err := pFlags.MarkHidden(f); err != nil {
logrus.Warnf("unable to mark %s flag as hidden: %s", f, err.Error())
logrus.Warnf("Unable to mark %s flag as hidden: %s", f, err.Error())
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/podman/system/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func service(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
logrus.Infof("using API endpoint: '%s'", apiURI)
logrus.Infof("Using API endpoint: '%s'", apiURI)
// Clean up any old existing unix domain socket
if len(apiURI) > 0 {
uri, err := url.Parse(apiURI)
Expand Down Expand Up @@ -120,7 +120,7 @@ func resolveAPIURI(_url []string) (string, error) {
case len(_url) > 0 && _url[0] != "":
return _url[0], nil
case systemd.SocketActivated():
logrus.Info("using systemd socket activation to determine API endpoint")
logrus.Info("Using systemd socket activation to determine API endpoint")
return "", nil
case rootless.IsRootless():
xdg, err := util.GetRuntimeDir()
Expand Down
2 changes: 1 addition & 1 deletion hack/podman-registry-go/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func Start() (*Registry, error) {
case portKey:
registry.Port = val
default:
logrus.Errorf("unexpected podman-registry output: %q", s)
logrus.Errorf("Unexpected podman-registry output: %q", s)
}
}

Expand Down
6 changes: 3 additions & 3 deletions libpod/boltdb_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ func (s *BoltState) AllContainers() ([]*Container, error) {
// not worth erroring over.
// If we do, a single bad container JSON
// could render libpod unusable.
logrus.Errorf("Error retrieving container %s from the database: %v", string(id), err)
logrus.Errorf("Retrieving container %s from the database: %v", string(id), err)
}
} else {
ctrs = append(ctrs, ctr)
Expand Down Expand Up @@ -2556,7 +2556,7 @@ func (s *BoltState) AllVolumes() ([]*Volume, error) {

if err := s.getVolumeFromDB(id, volume, volBucket); err != nil {
if errors.Cause(err) != define.ErrNSMismatch {
logrus.Errorf("Error retrieving volume %s from the database: %v", string(id), err)
logrus.Errorf("Retrieving volume %s from the database: %v", string(id), err)
}
} else {
volumes = append(volumes, volume)
Expand Down Expand Up @@ -3352,7 +3352,7 @@ func (s *BoltState) AllPods() ([]*Pod, error) {

if err := s.getPodFromDB(id, pod, podBucket); err != nil {
if errors.Cause(err) != define.ErrNSMismatch {
logrus.Errorf("Error retrieving pod %s from the database: %v", string(id), err)
logrus.Errorf("Retrieving pod %s from the database: %v", string(id), err)
}
} else {
pods = append(pods, pod)
Expand Down
4 changes: 2 additions & 2 deletions libpod/boltdb_state_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func (s *BoltState) getDBCon() (*bolt.DB, error) {
// of a defer statement only
func (s *BoltState) deferredCloseDBCon(db *bolt.DB) {
if err := s.closeDBCon(db); err != nil {
logrus.Errorf("failed to close libpod db: %q", err)
logrus.Errorf("Failed to close libpod db: %q", err)
}
}

Expand Down Expand Up @@ -875,7 +875,7 @@ func (s *BoltState) removeContainer(ctr *Container, pod *Pod, tx *bolt.Tx) error
podCtrs := podDB.Bucket(containersBkt)
if podCtrs == nil {
// Malformed pod
logrus.Errorf("pod %s malformed in database, missing containers bucket!", pod.ID())
logrus.Errorf("Pod %s malformed in database, missing containers bucket!", pod.ID())
} else {
ctrInPod := podCtrs.Get(ctrID)
if ctrInPod == nil {
Expand Down
2 changes: 1 addition & 1 deletion libpod/boltdb_state_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func replaceNetNS(netNSPath string, ctr *Container, newState *ContainerState) er
return errors.Wrapf(err, "error joining network namespace of container %s", ctr.ID())
}

logrus.Errorf("error joining network namespace for container %s: %v", ctr.ID(), err)
logrus.Errorf("Joining network namespace for container %s: %v", ctr.ID(), err)
ctr.state.NetNS = nil
}
}
Expand Down
2 changes: 1 addition & 1 deletion libpod/container_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (c *Container) Init(ctx context.Context, recursive bool) error {

if err := c.prepare(); err != nil {
if err2 := c.cleanup(ctx); err2 != nil {
logrus.Errorf("error cleaning up container %s: %v", c.ID(), err2)
logrus.Errorf("Cleaning up container %s: %v", c.ID(), err2)
}
return err
}
Expand Down
2 changes: 1 addition & 1 deletion libpod/container_commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (c *Container) Commit(ctx context.Context, destImage string, options Contai
}
defer func() {
if err := c.unpause(); err != nil {
logrus.Errorf("error unpausing container %q: %v", c.ID(), err)
logrus.Errorf("Unpausing container %q: %v", c.ID(), err)
}
}()
}
Expand Down
26 changes: 13 additions & 13 deletions libpod/container_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ func (c *Container) ExecHTTPStartAndAttach(sessionID string, r *http.Request, w
session.ExitCode = define.ExecErrorCodeGeneric

if err := c.save(); err != nil {
logrus.Errorf("Error saving container %s exec session %s after failure to prepare: %v", err, c.ID(), session.ID())
logrus.Errorf("Saving container %s exec session %s after failure to prepare: %v", err, c.ID(), session.ID())
}

return err
Expand All @@ -440,7 +440,7 @@ func (c *Container) ExecHTTPStartAndAttach(sessionID string, r *http.Request, w
session.ExitCode = define.TranslateExecErrorToExitCode(define.ExecErrorCodeGeneric, err)

if err := c.save(); err != nil {
logrus.Errorf("Error saving container %s exec session %s after failure to start: %v", err, c.ID(), session.ID())
logrus.Errorf("Saving container %s exec session %s after failure to start: %v", err, c.ID(), session.ID())
}

return err
Expand Down Expand Up @@ -549,7 +549,7 @@ func (c *Container) ExecStop(sessionID string, timeout *uint) error {

if err := c.cleanupExecBundle(session.ID()); err != nil {
if cleanupErr != nil {
logrus.Errorf("Error stopping container %s exec session %s: %v", c.ID(), session.ID(), cleanupErr)
logrus.Errorf("Stopping container %s exec session %s: %v", c.ID(), session.ID(), cleanupErr)
}
cleanupErr = err
}
Expand Down Expand Up @@ -695,7 +695,7 @@ func (c *Container) ExecResize(sessionID string, newSize define.TerminalSize) er
session.State = define.ExecStateStopped

if err := c.save(); err != nil {
logrus.Errorf("Error saving state of container %s: %v", c.ID(), err)
logrus.Errorf("Saving state of container %s: %v", c.ID(), err)
}

return errors.Wrapf(define.ErrExecSessionStateInvalid, "cannot resize container %s exec session %s as it has stopped", c.ID(), session.ID())
Expand Down Expand Up @@ -825,7 +825,7 @@ func (c *Container) createExecBundle(sessionID string) (retErr error) {
defer func() {
if retErr != nil {
if err := os.RemoveAll(bundlePath); err != nil {
logrus.Warnf("error removing exec bundle after creation caused another error: %v", err)
logrus.Warnf("Error removing exec bundle after creation caused another error: %v", err)
}
}
}()
Expand Down Expand Up @@ -911,7 +911,7 @@ func (c *Container) getActiveExecSessions() ([]string, error) {
alive, err := c.ociRuntime.ExecUpdateStatus(c, id)
if err != nil {
if lastErr != nil {
logrus.Errorf("Error checking container %s exec sessions: %v", c.ID(), lastErr)
logrus.Errorf("Checking container %s exec sessions: %v", c.ID(), lastErr)
}
lastErr = err
continue
Expand All @@ -926,7 +926,7 @@ func (c *Container) getActiveExecSessions() ([]string, error) {
exitCode, err := c.readExecExitCode(session.ID())
if err != nil {
if lastErr != nil {
logrus.Errorf("Error checking container %s exec sessions: %v", c.ID(), lastErr)
logrus.Errorf("Checking container %s exec sessions: %v", c.ID(), lastErr)
}
lastErr = err
}
Expand All @@ -940,7 +940,7 @@ func (c *Container) getActiveExecSessions() ([]string, error) {
}
if err := c.cleanupExecBundle(id); err != nil {
if lastErr != nil {
logrus.Errorf("Error checking container %s exec sessions: %v", c.ID(), lastErr)
logrus.Errorf("Checking container %s exec sessions: %v", c.ID(), lastErr)
}
lastErr = err
}
Expand All @@ -951,7 +951,7 @@ func (c *Container) getActiveExecSessions() ([]string, error) {
if needSave {
if err := c.save(); err != nil {
if lastErr != nil {
logrus.Errorf("Error reaping exec sessions for container %s: %v", c.ID(), lastErr)
logrus.Errorf("Reaping exec sessions for container %s: %v", c.ID(), lastErr)
}
lastErr = err
}
Expand All @@ -970,15 +970,15 @@ func (c *Container) removeAllExecSessions() error {
for _, id := range knownSessions {
if err := c.ociRuntime.ExecStopContainer(c, id, c.StopTimeout()); err != nil {
if lastErr != nil {
logrus.Errorf("Error stopping container %s exec sessions: %v", c.ID(), lastErr)
logrus.Errorf("Stopping container %s exec sessions: %v", c.ID(), lastErr)
}
lastErr = err
continue
}

if err := c.cleanupExecBundle(id); err != nil {
if lastErr != nil {
logrus.Errorf("Error stopping container %s exec sessions: %v", c.ID(), lastErr)
logrus.Errorf("Stopping container %s exec sessions: %v", c.ID(), lastErr)
}
lastErr = err
}
Expand All @@ -987,7 +987,7 @@ func (c *Container) removeAllExecSessions() error {
if err := c.runtime.state.RemoveContainerExecSessions(c); err != nil {
if errors.Cause(err) != define.ErrCtrRemoved {
if lastErr != nil {
logrus.Errorf("Error stopping container %s exec sessions: %v", c.ID(), lastErr)
logrus.Errorf("Stopping container %s exec sessions: %v", c.ID(), lastErr)
}
lastErr = err
}
Expand All @@ -997,7 +997,7 @@ func (c *Container) removeAllExecSessions() error {
if err := c.save(); err != nil {
if errors.Cause(err) != define.ErrCtrRemoved {
if lastErr != nil {
logrus.Errorf("Error stopping container %s exec sessions: %v", c.ID(), lastErr)
logrus.Errorf("Stopping container %s exec sessions: %v", c.ID(), lastErr)
}
lastErr = err
}
Expand Down
4 changes: 2 additions & 2 deletions libpod/container_inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,13 @@ func (c *Container) getContainerInspectData(size bool, driverData *define.Driver
if size {
rootFsSize, err := c.rootFsSize()
if err != nil {
logrus.Errorf("error getting rootfs size %q: %v", config.ID, err)
logrus.Errorf("Getting rootfs size %q: %v", config.ID, err)
}
data.SizeRootFs = rootFsSize

rwSize, err := c.rwSize()
if err != nil {
logrus.Errorf("error getting rw size %q: %v", config.ID, err)
logrus.Errorf("Getting rw size %q: %v", config.ID, err)
}
data.SizeRw = &rwSize
}
Expand Down
Loading

0 comments on commit f2eb5bb

Please sign in to comment.