summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/cliconfig/config.go1
-rw-r--r--cmd/podman/common.go8
-rw-r--r--cmd/podman/containers_prune.go1
-rw-r--r--cmd/podman/image.go10
-rw-r--r--cmd/podman/images_prune.go1
-rw-r--r--cmd/podman/info.go1
-rw-r--r--cmd/podman/play_kube.go11
-rw-r--r--cmd/podman/pod_create.go4
-rw-r--r--cmd/podman/pod_ps.go5
-rw-r--r--cmd/podman/ps.go5
-rw-r--r--cmd/podman/refresh.go5
-rw-r--r--cmd/podman/runlabel.go7
-rw-r--r--cmd/podman/system_renumber.go1
-rw-r--r--cmd/podman/varlink.go3
-rw-r--r--cmd/podman/version.go1
-rw-r--r--cmd/podman/volume_ls.go5
-rw-r--r--cmd/podman/volume_prune.go1
-rw-r--r--completions/bash/podman2
-rw-r--r--docs/podman-container-runlabel.1.md6
-rw-r--r--test/e2e/rmi_test.go9
20 files changed, 53 insertions, 34 deletions
diff --git a/cmd/podman/cliconfig/config.go b/cmd/podman/cliconfig/config.go
index a9032202f..702e20040 100644
--- a/cmd/podman/cliconfig/config.go
+++ b/cmd/podman/cliconfig/config.go
@@ -409,7 +409,6 @@ type RunlabelValues struct {
Opt2 string
Opt3 string
Quiet bool
- Pull bool
SignaturePolicy string
TlsVerify bool
}
diff --git a/cmd/podman/common.go b/cmd/podman/common.go
index e980e10f9..d3387b8f4 100644
--- a/cmd/podman/common.go
+++ b/cmd/podman/common.go
@@ -59,6 +59,14 @@ func checkAllAndLatest(c *cobra.Command, args []string, ignoreArgLen bool) error
return nil
}
+// noSubArgs checks that there are no further positional parameters
+func noSubArgs(c *cobra.Command, args []string) error {
+ if len(args) > 0 {
+ return errors.Errorf("`%s` takes no arguments", c.CommandPath())
+ }
+ return nil
+}
+
// getAllOrLatestContainers tries to return the correct list of containers
// depending if --all, --latest or <container-id> is used.
// It requires the Context (c) and the Runtime (runtime). As different
diff --git a/cmd/podman/containers_prune.go b/cmd/podman/containers_prune.go
index 6e4960429..0d0e75332 100644
--- a/cmd/podman/containers_prune.go
+++ b/cmd/podman/containers_prune.go
@@ -21,6 +21,7 @@ var (
`
_pruneContainersCommand = &cobra.Command{
Use: "prune",
+ Args: noSubArgs,
Short: "Remove all stopped containers",
Long: pruneContainersDescription,
RunE: func(cmd *cobra.Command, args []string) error {
diff --git a/cmd/podman/image.go b/cmd/podman/image.go
index b5c1c3ccf..0777425eb 100644
--- a/cmd/podman/image.go
+++ b/cmd/podman/image.go
@@ -1,6 +1,8 @@
package main
import (
+ "strings"
+
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/spf13/cobra"
)
@@ -39,11 +41,13 @@ func init() {
imageCommand.AddCommand(getImageSubCommands()...)
// Setup of "images" to appear as "list"
- _imagesSubCommand.Use = "list"
+ _imagesSubCommand.Use = strings.Replace(_imagesSubCommand.Use, "images", "list", 1)
_imagesSubCommand.Aliases = []string{"ls"}
+ _imagesSubCommand.Example = strings.Replace(_imagesSubCommand.Example, "podman images", "podman image list", -1)
imageCommand.AddCommand(&_imagesSubCommand)
- // Setup of "rmi" to appears as "rm"
- _rmSubCommand.Use = "rm"
+ // It makes no sense to keep 'podman images rmi'; just use 'rm'
+ _rmSubCommand.Use = strings.Replace(_rmSubCommand.Use, "rmi", "rm", 1)
+ _rmSubCommand.Example = strings.Replace(_rmSubCommand.Example, "podman rmi", "podman image rm", -1)
imageCommand.AddCommand(&_rmSubCommand)
}
diff --git a/cmd/podman/images_prune.go b/cmd/podman/images_prune.go
index 79dcd097c..427374f68 100644
--- a/cmd/podman/images_prune.go
+++ b/cmd/podman/images_prune.go
@@ -18,6 +18,7 @@ var (
`
_pruneImagesCommand = &cobra.Command{
Use: "prune",
+ Args: noSubArgs,
Short: "Remove unused images",
Long: pruneImagesDescription,
RunE: func(cmd *cobra.Command, args []string) error {
diff --git a/cmd/podman/info.go b/cmd/podman/info.go
index a1473dac9..e87f4e151 100644
--- a/cmd/podman/info.go
+++ b/cmd/podman/info.go
@@ -19,6 +19,7 @@ var (
infoDescription = "Display podman system information"
_infoCommand = &cobra.Command{
Use: "info",
+ Args: noSubArgs,
Long: infoDescription,
Short: `Display information pertaining to the host, current storage stats, and build of podman. Useful for the user and when reporting issues.`,
RunE: func(cmd *cobra.Command, args []string) error {
diff --git a/cmd/podman/play_kube.go b/cmd/podman/play_kube.go
index 6f23e340e..ac46ad5c6 100644
--- a/cmd/podman/play_kube.go
+++ b/cmd/podman/play_kube.go
@@ -90,8 +90,17 @@ func playKubeYAMLCmd(c *cliconfig.KubePlayValues) error {
return errors.Wrapf(err, "unable to read %s as YAML", args[0])
}
+ // check for name collision between pod and container
+ podName := podYAML.ObjectMeta.Name
+ for _, n := range podYAML.Spec.Containers {
+ if n.Name == podName {
+ fmt.Printf("a container exists with the same name (%s) as the pod in your YAML file; changing pod name to %s_pod\n", podName, podName)
+ podName = fmt.Sprintf("%s_pod", podName)
+ }
+ }
+
podOptions = append(podOptions, libpod.WithInfraContainer())
- podOptions = append(podOptions, libpod.WithPodName(podYAML.ObjectMeta.Name))
+ podOptions = append(podOptions, libpod.WithPodName(podName))
// TODO for now we just used the default kernel namespaces; we need to add/subtract this from yaml
nsOptions, err := shared.GetNamespaceOptions(strings.Split(DefaultKernelNamespaces, ","))
diff --git a/cmd/podman/pod_create.go b/cmd/podman/pod_create.go
index f1bbecb84..43c211b2c 100644
--- a/cmd/podman/pod_create.go
+++ b/cmd/podman/pod_create.go
@@ -24,6 +24,7 @@ var (
_podCreateCommand = &cobra.Command{
Use: "create",
+ Args: noSubArgs,
Short: "Create a new empty pod",
Long: podCreateDescription,
RunE: func(cmd *cobra.Command, args []string) error {
@@ -59,9 +60,6 @@ func podCreateCmd(c *cliconfig.PodCreateValues) error {
podIdFile *os.File
)
- if len(c.InputArgs) > 0 {
- return errors.New("podman pod create does not accept any arguments")
- }
runtime, err := adapter.GetRuntime(&c.PodmanCommand)
if err != nil {
return errors.Wrapf(err, "error creating libpod runtime")
diff --git a/cmd/podman/pod_ps.go b/cmd/podman/pod_ps.go
index 70e077651..8e48740e6 100644
--- a/cmd/podman/pod_ps.go
+++ b/cmd/podman/pod_ps.go
@@ -121,6 +121,7 @@ var (
_podPsCommand = &cobra.Command{
Use: "ps",
Aliases: []string{"ls", "list"},
+ Args: noSubArgs,
Short: "List pods",
Long: podPsDescription,
RunE: func(cmd *cobra.Command, args []string) error {
@@ -160,10 +161,6 @@ func podPsCmd(c *cliconfig.PodPsValues) error {
}
defer runtime.Shutdown(false)
- if len(c.InputArgs) > 0 {
- return errors.Errorf("too many arguments, ps takes no arguments")
- }
-
opts := podPsOptions{
NoTrunc: c.NoTrunc,
Quiet: c.Quiet,
diff --git a/cmd/podman/ps.go b/cmd/podman/ps.go
index fe4173fdd..acb5fd7da 100644
--- a/cmd/podman/ps.go
+++ b/cmd/podman/ps.go
@@ -159,6 +159,7 @@ var (
psDescription = "Prints out information about the containers"
_psCommand = cobra.Command{
Use: "ps",
+ Args: noSubArgs,
Short: "List containers",
Long: psDescription,
RunE: func(cmd *cobra.Command, args []string) error {
@@ -215,10 +216,6 @@ func psCmd(c *cliconfig.PsValues) error {
defer runtime.Shutdown(false)
- if len(c.InputArgs) > 0 {
- return errors.Errorf("too many arguments, ps takes no arguments")
- }
-
opts := shared.PsOptions{
All: c.All,
Format: c.Format,
diff --git a/cmd/podman/refresh.go b/cmd/podman/refresh.go
index 193be6953..1e4a31a52 100644
--- a/cmd/podman/refresh.go
+++ b/cmd/podman/refresh.go
@@ -15,6 +15,7 @@ var (
refreshDescription = "The refresh command resets the state of all containers to handle database changes after a Podman upgrade. All running containers will be restarted."
_refreshCommand = &cobra.Command{
Use: "refresh",
+ Args: noSubArgs,
Short: "Refresh container state",
Long: refreshDescription,
RunE: func(cmd *cobra.Command, args []string) error {
@@ -32,10 +33,6 @@ func init() {
}
func refreshCmd(c *cliconfig.RefreshValues) error {
- if len(c.InputArgs) > 0 {
- return errors.Errorf("refresh does not accept any arguments")
- }
-
runtime, err := libpodruntime.GetRuntime(&c.PodmanCommand)
if err != nil {
return errors.Wrapf(err, "error creating libpod runtime")
diff --git a/cmd/podman/runlabel.go b/cmd/podman/runlabel.go
index bc4e650f9..f91ffed0d 100644
--- a/cmd/podman/runlabel.go
+++ b/cmd/podman/runlabel.go
@@ -53,10 +53,12 @@ func init() {
flags.MarkHidden("opt2")
flags.MarkHidden("opt3")
- flags.BoolVarP(&runlabelCommand.Pull, "pull", "p", false, "Pull the image if it does not exist locally prior to executing the label contents")
+ flags.BoolP("pull", "p", false, "Pull the image if it does not exist locally prior to executing the label contents")
flags.BoolVarP(&runlabelCommand.Quiet, "quiet", "q", false, "Suppress output information when installing images")
flags.StringVar(&runlabelCommand.SignaturePolicy, "signature-policy", "", "`Pathname` of signature policy file (not usually used)")
flags.BoolVar(&runlabelCommand.TlsVerify, "tls-verify", true, "Require HTTPS and verify certificates when contacting registries (default: true)")
+
+ flags.MarkDeprecated("pull", "podman will pull if not found in local storage")
}
// installCmd gets the data from the command line and calls installImage
@@ -95,7 +97,6 @@ func runlabelCmd(c *cliconfig.RunlabelValues) error {
if len(args) > 2 {
extraArgs = args[2:]
}
- pull := c.Pull
label := args[0]
runlabelImage := args[1]
@@ -131,7 +132,7 @@ func runlabelCmd(c *cliconfig.RunlabelValues) error {
}
authfile := getAuthFile(c.Authfile)
- runLabel, imageName, err := shared.GetRunlabel(label, runlabelImage, ctx, runtime, pull, c.Creds, dockerRegistryOptions, authfile, c.SignaturePolicy, stdOut)
+ runLabel, imageName, err := shared.GetRunlabel(label, runlabelImage, ctx, runtime, true, c.Creds, dockerRegistryOptions, authfile, c.SignaturePolicy, stdOut)
if err != nil {
return err
}
diff --git a/cmd/podman/system_renumber.go b/cmd/podman/system_renumber.go
index c8ce628b1..31137b9f6 100644
--- a/cmd/podman/system_renumber.go
+++ b/cmd/podman/system_renumber.go
@@ -18,6 +18,7 @@ var (
_renumberCommand = &cobra.Command{
Use: "renumber",
+ Args: noSubArgs,
Short: "Migrate lock numbers",
Long: renumberDescription,
RunE: func(cmd *cobra.Command, args []string) error {
diff --git a/cmd/podman/varlink.go b/cmd/podman/varlink.go
index f19d03885..5cc79ef96 100644
--- a/cmd/podman/varlink.go
+++ b/cmd/podman/varlink.go
@@ -49,6 +49,9 @@ func varlinkCmd(c *cliconfig.VarlinkValues) error {
if len(args) < 1 {
return errors.Errorf("you must provide a varlink URI")
}
+ if len(args) > 1 {
+ return errors.Errorf("too many arguments. Requires exactly 1")
+ }
timeout := time.Duration(c.Timeout) * time.Millisecond
// Create a single runtime for varlink
diff --git a/cmd/podman/version.go b/cmd/podman/version.go
index c65ba94f9..b3615ce23 100644
--- a/cmd/podman/version.go
+++ b/cmd/podman/version.go
@@ -17,6 +17,7 @@ var (
versionCommand cliconfig.VersionValues
_versionCommand = &cobra.Command{
Use: "version",
+ Args: noSubArgs,
Short: "Display the Podman Version Information",
RunE: func(cmd *cobra.Command, args []string) error {
versionCommand.InputArgs = args
diff --git a/cmd/podman/volume_ls.go b/cmd/podman/volume_ls.go
index 5adfc1e91..6855f38e0 100644
--- a/cmd/podman/volume_ls.go
+++ b/cmd/podman/volume_ls.go
@@ -49,6 +49,7 @@ and the output format can be changed to JSON or a user specified Go template.
_volumeLsCommand = &cobra.Command{
Use: "ls",
Aliases: []string{"list"},
+ Args: noSubArgs,
Short: "List volumes",
Long: volumeLsDescription,
RunE: func(cmd *cobra.Command, args []string) error {
@@ -76,10 +77,6 @@ func volumeLsCmd(c *cliconfig.VolumeLsValues) error {
}
defer runtime.Shutdown(false)
- if len(c.InputArgs) > 0 {
- return errors.Errorf("too many arguments, ls takes no arguments")
- }
-
opts := volumeLsOptions{
Quiet: c.Quiet,
}
diff --git a/cmd/podman/volume_prune.go b/cmd/podman/volume_prune.go
index 1f7931aa4..370f072eb 100644
--- a/cmd/podman/volume_prune.go
+++ b/cmd/podman/volume_prune.go
@@ -24,6 +24,7 @@ using force.
`
_volumePruneCommand = &cobra.Command{
Use: "prune",
+ Args: noSubArgs,
Short: "Remove all unused volumes",
Long: volumePruneDescription,
RunE: func(cmd *cobra.Command, args []string) error {
diff --git a/completions/bash/podman b/completions/bash/podman
index 36ac27d52..74e3a49d2 100644
--- a/completions/bash/podman
+++ b/completions/bash/podman
@@ -2401,8 +2401,6 @@ _podman_container_runlabel() {
--display
--help
-h
- -p
- --pull
-q
--quiet
--tls-verify
diff --git a/docs/podman-container-runlabel.1.md b/docs/podman-container-runlabel.1.md
index c5d7a278f..7547f7187 100644
--- a/docs/podman-container-runlabel.1.md
+++ b/docs/podman-container-runlabel.1.md
@@ -9,7 +9,6 @@ podman-container-runlabel - Execute Image Label Method
[**-h**|**--help**]
[**--display**]
[**-n**][**--name**[=*NAME*]]
-[**-p**][[**--pull**]]
[**--rootfs**=*ROOTFS*]
[**--set**=*NAME*=*VALUE*]
[**--storage**]
@@ -27,7 +26,7 @@ If the container image has a LABEL INSTALL instruction like the following:
`podman container runlabel` will set the following environment variables for use in the command:
If the container image does not have the desired label, an error message will be displayed along with a non-zero
-return code.
+return code. If the image is not found in local storage, Podman will attempt to pull it first.
Note: Podman will always ensure that `podman` is the first argument of the command being executed.
@@ -82,9 +81,6 @@ Print usage statement
**-n** **--name**=""
Use this name for creating content for the container. NAME will default to the IMAGENAME if it is not specified.
-**p** **--pull**
- Pull the image if it cannot be found in local storage.
-
**--quiet, -q**
Suppress output information when pulling images
diff --git a/test/e2e/rmi_test.go b/test/e2e/rmi_test.go
index dcbda2df4..26cc925ef 100644
--- a/test/e2e/rmi_test.go
+++ b/test/e2e/rmi_test.go
@@ -275,4 +275,13 @@ RUN find $LOCAL
Expect(images.ExitCode()).To(Equal(0))
Expect(len(images.OutputToStringArray())).To(Equal(0))
})
+
+ // Don't rerun all tests; just assume that if we get that diagnostic,
+ // we're getting rmi
+ It("podman image rm is the same as rmi", func() {
+ session := podmanTest.Podman([]string{"image", "rm"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
+ Expect(session.LineInOutputContains("image name or ID must be specified"))
+ })
})