From abf3500e8f672e71c6e91fd5bbb70da6abd4d5af Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Mon, 18 Mar 2019 13:22:39 -0600 Subject: podman umount: error out if called with no args Inspired by #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, and solution is simple: checkAllAndLatest() already does the check for us. Resolve a few other problems uncovered by testing: podman mount: indicate that CONTAINER arg is optional podman pod stats: ditto podman generate kube: remove check for -l (latest) flag, it isn't actually implemented. Signed-off-by: Ed Santiago --- cmd/podman/generate_kube.go | 4 ++-- cmd/podman/mount.go | 2 +- cmd/podman/pod_stats.go | 2 +- cmd/podman/umount.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'cmd') diff --git a/cmd/podman/generate_kube.go b/cmd/podman/generate_kube.go index e3db14af3..42cfba8d8 100644 --- a/cmd/podman/generate_kube.go +++ b/cmd/podman/generate_kube.go @@ -57,8 +57,8 @@ func generateKubeYAMLCmd(c *cliconfig.GenerateKubeValues) error { return errors.Wrapf(libpod.ErrNotImplemented, "rootless users") } args := c.InputArgs - if len(args) > 1 || (len(args) < 1 && !c.Bool("latest")) { - return errors.Errorf("you must provide one container|pod ID or name or --latest") + if len(args) != 1 { + return errors.Errorf("you must provide exactly one container|pod ID or name") } runtime, err := libpodruntime.GetRuntime(&c.PodmanCommand) diff --git a/cmd/podman/mount.go b/cmd/podman/mount.go index 4381074ab..d074551ce 100644 --- a/cmd/podman/mount.go +++ b/cmd/podman/mount.go @@ -25,7 +25,7 @@ var ( ` _mountCommand = &cobra.Command{ - Use: "mount [flags] CONTAINER", + Use: "mount [flags] [CONTAINER]", Short: "Mount a working container's root filesystem", Long: mountDescription, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/pod_stats.go b/cmd/podman/pod_stats.go index 701051938..e8ff322ce 100644 --- a/cmd/podman/pod_stats.go +++ b/cmd/podman/pod_stats.go @@ -25,7 +25,7 @@ var ( podStatsDescription = `For each specified pod this command will display percentage of CPU, memory, network I/O, block I/O and PIDs for containers in one the pods.` _podStatsCommand = &cobra.Command{ - Use: "stats [flags] POD [POD...]", + Use: "stats [flags] [POD...]", Short: "Display a live stream of resource usage statistics for the containers in one or more pods", Long: podStatsDescription, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/umount.go b/cmd/podman/umount.go index c57d5794c..a938c7c38 100644 --- a/cmd/podman/umount.go +++ b/cmd/podman/umount.go @@ -31,7 +31,7 @@ var ( return umountCmd(&umountCommand) }, Args: func(cmd *cobra.Command, args []string) error { - return checkAllAndLatest(cmd, args, true) + return checkAllAndLatest(cmd, args, false) }, Example: `podman umount ctrID podman umount ctrID1 ctrID2 ctrID3 -- cgit v1.2.3-54-g00ecf