Skip to content

Commit

Permalink
podman umount: error out if called with no args
Browse files Browse the repository at this point in the history
Inspired by containers#2684, I wrote a CI test to look for other such
instances in which a command is invoked without a required
argument. 'podman umount' seems to be the only one.

Signed-off-by: Ed Santiago <santiago@redhat.com>
  • Loading branch information
edsantiago committed Mar 18, 2019
1 parent 03160dc commit feb9a37
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/podman/umount.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ func umountCmd(c *cliconfig.UmountValues) error {
force := c.Force
umountAll := c.All

if len(c.PodmanCommand.InputArgs) < 1 && !umountAll {
return errors.Errorf("you must provide at least one mounted container, or the -a flag")
}

containers, err := getAllOrLatestContainers(&c.PodmanCommand, runtime, -1, "all")
if err != nil {
if len(containers) == 0 {
Expand Down

0 comments on commit feb9a37

Please sign in to comment.