Skip to content

Commit

Permalink
Exit with errors not just logging error
Browse files Browse the repository at this point in the history
Several commands were logging errors but exiting with a 0
exit code.  This patch cleans these up.

Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed Feb 22, 2019
1 parent 84b3f2a commit 3775c6d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
9 changes: 3 additions & 6 deletions cmd/podman/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,16 @@ func pullCmd(c *cliconfig.PullValues) error {

args := c.InputArgs
if len(args) == 0 {
logrus.Errorf("an image name must be specified")
return nil
return errors.Errorf("an image name must be specified")
}
if len(args) > 1 {
logrus.Errorf("too many arguments. Requires exactly 1")
return nil
return errors.Errorf("too many arguments. Requires exactly 1")
}

arr := strings.SplitN(args[0], ":", 2)
if len(arr) == 2 {
if c.Bool("all-tags") {
logrus.Errorf("tag can't be used with --all-tags")
return nil
return errors.Errorf("tag can't be used with --all-tags")
}
}
ctx := getContext()
Expand Down
4 changes: 1 addition & 3 deletions cmd/podman/runlabel.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/containers/libpod/libpod/image"
"github.com/containers/libpod/utils"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -87,8 +86,7 @@ func runlabelCmd(c *cliconfig.RunlabelValues) error {

args := c.InputArgs
if len(args) < 2 {
logrus.Errorf("the runlabel command requires at least 2 arguments: LABEL IMAGE")
return nil
return errors.Errorf("the runlabel command requires at least 2 arguments: LABEL IMAGE")
}
if c.Display && c.Quiet {
return errors.Errorf("the display and quiet flags cannot be used together.")
Expand Down

0 comments on commit 3775c6d

Please sign in to comment.