summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-04-28 23:29:20 +0200
committerGitHub <noreply@github.com>2020-04-28 23:29:20 +0200
commitbf4efc1953467907ae7d75d5f3ef3cd41505ee24 (patch)
treef6743d64621b126ff5e5f92c46fa4e56d279f26b /cmd/podman
parentdcac908bbe879a8b0b453531252dddccf8690077 (diff)
parent517bc28360ba6417d5333720f03f010514862ec3 (diff)
downloadpodman-bf4efc1953467907ae7d75d5f3ef3cd41505ee24.tar.gz
podman-bf4efc1953467907ae7d75d5f3ef3cd41505ee24.tar.bz2
podman-bf4efc1953467907ae7d75d5f3ef3cd41505ee24.zip
Merge pull request #6026 from baude/v2forcesystemtests
system tests must pass
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/common/util.go11
-rw-r--r--cmd/podman/containers/exists.go5
-rw-r--r--cmd/podman/containers/list.go3
-rw-r--r--cmd/podman/containers/port.go2
-rw-r--r--cmd/podman/containers/ps.go6
-rw-r--r--cmd/podman/images/exists.go1
-rw-r--r--cmd/podman/images/images.go13
-rw-r--r--cmd/podman/images/list.go3
-rw-r--r--cmd/podman/images/prune.go3
-rw-r--r--cmd/podman/main.go1
-rw-r--r--cmd/podman/manifest/add.go2
-rw-r--r--cmd/podman/manifest/create.go2
-rw-r--r--cmd/podman/manifest/inspect.go2
-rw-r--r--cmd/podman/networks/network.go3
-rw-r--r--cmd/podman/pods/create.go2
-rw-r--r--cmd/podman/pods/exists.go1
-rw-r--r--cmd/podman/pods/ps.go2
-rw-r--r--cmd/podman/root.go2
-rw-r--r--cmd/podman/system/events.go3
-rw-r--r--cmd/podman/system/info.go3
-rw-r--r--cmd/podman/system/version.go3
-rw-r--r--cmd/podman/volumes/list.go3
-rw-r--r--cmd/podman/volumes/prune.go3
23 files changed, 55 insertions, 24 deletions
diff --git a/cmd/podman/common/util.go b/cmd/podman/common/util.go
index 47bbe12fa..5b99b8398 100644
--- a/cmd/podman/common/util.go
+++ b/cmd/podman/common/util.go
@@ -1,8 +1,11 @@
package common
import (
+ "fmt"
"strconv"
+ "github.com/spf13/cobra"
+
"github.com/cri-o/ocicni/pkg/ocicni"
"github.com/docker/go-connections/nat"
"github.com/pkg/errors"
@@ -41,3 +44,11 @@ func createPortBindings(ports []string) ([]ocicni.PortMapping, error) {
}
return portBindings, nil
}
+
+// NoArgs returns an error if any args are included.
+func NoArgs(cmd *cobra.Command, args []string) error {
+ if len(args) > 0 {
+ return fmt.Errorf("`%s` takes no arguments", cmd.CommandPath())
+ }
+ return nil
+}
diff --git a/cmd/podman/containers/exists.go b/cmd/podman/containers/exists.go
index e640ca5e1..81ba8a282 100644
--- a/cmd/podman/containers/exists.go
+++ b/cmd/podman/containers/exists.go
@@ -17,8 +17,9 @@ var (
Long: containerExistsDescription,
Example: `podman container exists containerID
podman container exists myctr || podman run --name myctr [etc...]`,
- RunE: exists,
- Args: cobra.ExactArgs(1),
+ RunE: exists,
+ Args: cobra.ExactArgs(1),
+ DisableFlagsInUseLine: true,
}
)
diff --git a/cmd/podman/containers/list.go b/cmd/podman/containers/list.go
index b5019ddd2..22fa15b7e 100644
--- a/cmd/podman/containers/list.go
+++ b/cmd/podman/containers/list.go
@@ -1,6 +1,7 @@
package containers
import (
+ "github.com/containers/libpod/cmd/podman/common"
"github.com/containers/libpod/cmd/podman/registry"
"github.com/containers/libpod/pkg/domain/entities"
"github.com/spf13/cobra"
@@ -11,7 +12,7 @@ var (
listCmd = &cobra.Command{
Use: "list",
Aliases: []string{"ls"},
- Args: cobra.NoArgs,
+ Args: common.NoArgs,
Short: "List containers",
Long: "Prints out information about the containers",
RunE: ps,
diff --git a/cmd/podman/containers/port.go b/cmd/podman/containers/port.go
index 0e50140ca..2e3386aa9 100644
--- a/cmd/podman/containers/port.go
+++ b/cmd/podman/containers/port.go
@@ -109,7 +109,7 @@ func port(cmd *cobra.Command, args []string) error {
fmt.Printf("%d/%s -> %s:%d\n", v.ContainerPort, v.Protocol, hostIP, v.HostPort)
continue
}
- if v == userPort {
+ if v.ContainerPort == userPort.ContainerPort {
fmt.Printf("%s:%d\n", hostIP, v.HostPort)
found = true
break
diff --git a/cmd/podman/containers/ps.go b/cmd/podman/containers/ps.go
index 82434e9cc..44f50bab2 100644
--- a/cmd/podman/containers/ps.go
+++ b/cmd/podman/containers/ps.go
@@ -12,6 +12,7 @@ import (
tm "github.com/buger/goterm"
"github.com/containers/buildah/pkg/formats"
+ "github.com/containers/libpod/cmd/podman/common"
"github.com/containers/libpod/cmd/podman/registry"
"github.com/containers/libpod/pkg/domain/entities"
"github.com/cri-o/ocicni/pkg/ocicni"
@@ -25,7 +26,7 @@ var (
psDescription = "Prints out information about the containers"
psCommand = &cobra.Command{
Use: "ps",
- Args: checkFlags,
+ Args: common.NoArgs,
Short: "List containers",
Long: psDescription,
RunE: ps,
@@ -141,6 +142,9 @@ func getResponses() ([]entities.ListContainer, error) {
func ps(cmd *cobra.Command, args []string) error {
var responses []psReporter
+ if err := checkFlags(cmd, args); err != nil {
+ return err
+ }
for _, f := range filters {
split := strings.SplitN(f, "=", 2)
if len(split) == 1 {
diff --git a/cmd/podman/images/exists.go b/cmd/podman/images/exists.go
index 6464e6cd8..13191113f 100644
--- a/cmd/podman/images/exists.go
+++ b/cmd/podman/images/exists.go
@@ -15,6 +15,7 @@ var (
RunE: exists,
Example: `podman image exists ID
podman image exists IMAGE && podman pull IMAGE`,
+ DisableFlagsInUseLine: true,
}
)
diff --git a/cmd/podman/images/images.go b/cmd/podman/images/images.go
index fd3ede26a..96ef344bf 100644
--- a/cmd/podman/images/images.go
+++ b/cmd/podman/images/images.go
@@ -11,12 +11,13 @@ import (
var (
// podman _images_ Alias for podman image _list_
imagesCmd = &cobra.Command{
- Use: strings.Replace(listCmd.Use, "list", "images", 1),
- Args: listCmd.Args,
- Short: listCmd.Short,
- Long: listCmd.Long,
- RunE: listCmd.RunE,
- Example: strings.Replace(listCmd.Example, "podman image list", "podman images", -1),
+ Use: strings.Replace(listCmd.Use, "list", "images", 1),
+ Args: listCmd.Args,
+ Short: listCmd.Short,
+ Long: listCmd.Long,
+ RunE: listCmd.RunE,
+ Example: strings.Replace(listCmd.Example, "podman image list", "podman images", -1),
+ DisableFlagsInUseLine: true,
}
)
diff --git a/cmd/podman/images/list.go b/cmd/podman/images/list.go
index b979cb6af..552fed804 100644
--- a/cmd/podman/images/list.go
+++ b/cmd/podman/images/list.go
@@ -32,7 +32,7 @@ type listFlagType struct {
var (
// Command: podman image _list_
listCmd = &cobra.Command{
- Use: "list [flag] [IMAGE]",
+ Use: "list [FLAGS] [IMAGE]",
Aliases: []string{"ls"},
Args: cobra.MaximumNArgs(1),
Short: "List images in local storage",
@@ -41,6 +41,7 @@ var (
Example: `podman image list --format json
podman image list --sort repository --format "table {{.ID}} {{.Repository}} {{.Tag}}"
podman image list --filter dangling=true`,
+ DisableFlagsInUseLine: true,
}
// Options to pull data
diff --git a/cmd/podman/images/prune.go b/cmd/podman/images/prune.go
index b90d889be..eb9e4a7e4 100644
--- a/cmd/podman/images/prune.go
+++ b/cmd/podman/images/prune.go
@@ -6,6 +6,7 @@ import (
"os"
"strings"
+ "github.com/containers/libpod/cmd/podman/common"
"github.com/containers/libpod/cmd/podman/registry"
"github.com/containers/libpod/pkg/domain/entities"
"github.com/pkg/errors"
@@ -18,7 +19,7 @@ var (
If an image is not being used by a container, it will be removed from the system.`
pruneCmd = &cobra.Command{
Use: "prune",
- Args: cobra.NoArgs,
+ Args: common.NoArgs,
Short: "Remove unused images",
Long: pruneDescription,
RunE: prune,
diff --git a/cmd/podman/main.go b/cmd/podman/main.go
index 8109eca2f..4cd0beee8 100644
--- a/cmd/podman/main.go
+++ b/cmd/podman/main.go
@@ -7,7 +7,6 @@ import (
_ "github.com/containers/libpod/cmd/podman/healthcheck"
_ "github.com/containers/libpod/cmd/podman/images"
_ "github.com/containers/libpod/cmd/podman/manifest"
- _ "github.com/containers/libpod/cmd/podman/networks"
_ "github.com/containers/libpod/cmd/podman/pods"
"github.com/containers/libpod/cmd/podman/registry"
_ "github.com/containers/libpod/cmd/podman/system"
diff --git a/cmd/podman/manifest/add.go b/cmd/podman/manifest/add.go
index c83beff7a..38f832fad 100644
--- a/cmd/podman/manifest/add.go
+++ b/cmd/podman/manifest/add.go
@@ -13,7 +13,7 @@ import (
var (
manifestAddOpts = entities.ManifestAddOptions{}
addCmd = &cobra.Command{
- Use: "add",
+ Use: "add [flags] LIST LIST",
Short: "Add images to a manifest list or image index",
Long: "Adds an image to a manifest list or image index.",
RunE: add,
diff --git a/cmd/podman/manifest/create.go b/cmd/podman/manifest/create.go
index 4f3e27774..9c0097b90 100644
--- a/cmd/podman/manifest/create.go
+++ b/cmd/podman/manifest/create.go
@@ -13,7 +13,7 @@ import (
var (
manifestCreateOpts = entities.ManifestCreateOptions{}
createCmd = &cobra.Command{
- Use: "create",
+ Use: "create [flags] LIST [IMAGE]",
Short: "Create manifest list or image index",
Long: "Creates manifest lists or image indexes.",
RunE: create,
diff --git a/cmd/podman/manifest/inspect.go b/cmd/podman/manifest/inspect.go
index 36ecdc87b..5112aa5b2 100644
--- a/cmd/podman/manifest/inspect.go
+++ b/cmd/podman/manifest/inspect.go
@@ -12,7 +12,7 @@ import (
var (
inspectCmd = &cobra.Command{
- Use: "inspect IMAGE",
+ Use: "inspect [flags] IMAGE",
Short: "Display the contents of a manifest list or image index",
Long: "Display the contents of a manifest list or image index.",
RunE: inspect,
diff --git a/cmd/podman/networks/network.go b/cmd/podman/networks/network.go
index 3cee86bcc..a0e412098 100644
--- a/cmd/podman/networks/network.go
+++ b/cmd/podman/networks/network.go
@@ -17,6 +17,9 @@ var (
}
)
+// TODO add the following to main.go to get networks back onto the
+// command list.
+//_ "github.com/containers/libpod/cmd/podman/networks"
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
Mode: []entities.EngineMode{entities.ABIMode},
diff --git a/cmd/podman/pods/create.go b/cmd/podman/pods/create.go
index ff21166f3..0c0d07b3e 100644
--- a/cmd/podman/pods/create.go
+++ b/cmd/podman/pods/create.go
@@ -24,7 +24,7 @@ var (
createCommand = &cobra.Command{
Use: "create",
- Args: cobra.NoArgs,
+ Args: common.NoArgs,
Short: "Create a new empty pod",
Long: podCreateDescription,
RunE: create,
diff --git a/cmd/podman/pods/exists.go b/cmd/podman/pods/exists.go
index 5a94bf150..cf3e3eae5 100644
--- a/cmd/podman/pods/exists.go
+++ b/cmd/podman/pods/exists.go
@@ -19,6 +19,7 @@ var (
Args: cobra.ExactArgs(1),
Example: `podman pod exists podID
podman pod exists mypod || podman pod create --name mypod`,
+ DisableFlagsInUseLine: true,
}
)
diff --git a/cmd/podman/pods/ps.go b/cmd/podman/pods/ps.go
index 6d0d9cf7f..8ae1f91a8 100644
--- a/cmd/podman/pods/ps.go
+++ b/cmd/podman/pods/ps.go
@@ -11,6 +11,7 @@ import (
"text/template"
"time"
+ "github.com/containers/libpod/cmd/podman/common"
"github.com/containers/libpod/cmd/podman/registry"
"github.com/containers/libpod/pkg/domain/entities"
"github.com/docker/go-units"
@@ -28,6 +29,7 @@ var (
Short: "list pods",
Long: psDescription,
RunE: pods,
+ Args: common.NoArgs,
}
)
diff --git a/cmd/podman/root.go b/cmd/podman/root.go
index 84c3867f2..56ca549b6 100644
--- a/cmd/podman/root.go
+++ b/cmd/podman/root.go
@@ -34,7 +34,7 @@ Description:
// UsageTemplate is the usage template for podman commands
// This blocks the displaying of the global options. The main podman
// command should not use this.
-const usageTemplate = `Usage(v2):{{if (and .Runnable (not .HasAvailableSubCommands))}}
+const usageTemplate = `Usage:{{if (and .Runnable (not .HasAvailableSubCommands))}}
{{.UseLine}}{{end}}{{if .HasAvailableSubCommands}}
{{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}}
diff --git a/cmd/podman/system/events.go b/cmd/podman/system/events.go
index 3c1943b55..31dd9aa77 100644
--- a/cmd/podman/system/events.go
+++ b/cmd/podman/system/events.go
@@ -7,6 +7,7 @@ import (
"os"
"github.com/containers/buildah/pkg/formats"
+ "github.com/containers/libpod/cmd/podman/common"
"github.com/containers/libpod/cmd/podman/registry"
"github.com/containers/libpod/libpod/events"
"github.com/containers/libpod/pkg/domain/entities"
@@ -18,7 +19,7 @@ var (
eventsDescription = "Monitor podman events"
eventsCommand = &cobra.Command{
Use: "events",
- Args: cobra.NoArgs,
+ Args: common.NoArgs,
Short: "Show podman events",
Long: eventsDescription,
RunE: eventsCmd,
diff --git a/cmd/podman/system/info.go b/cmd/podman/system/info.go
index 8b36ef549..143796938 100644
--- a/cmd/podman/system/info.go
+++ b/cmd/podman/system/info.go
@@ -5,6 +5,7 @@ import (
"os"
"text/template"
+ "github.com/containers/libpod/cmd/podman/common"
"github.com/containers/libpod/cmd/podman/registry"
"github.com/containers/libpod/pkg/domain/entities"
"github.com/ghodss/yaml"
@@ -18,7 +19,7 @@ var (
`
infoCommand = &cobra.Command{
Use: "info",
- Args: cobra.NoArgs,
+ Args: common.NoArgs,
Long: infoDescription,
Short: "Display podman system information",
RunE: info,
diff --git a/cmd/podman/system/version.go b/cmd/podman/system/version.go
index 5d3874de3..b0f4eb528 100644
--- a/cmd/podman/system/version.go
+++ b/cmd/podman/system/version.go
@@ -9,6 +9,7 @@ import (
"time"
"github.com/containers/buildah/pkg/formats"
+ "github.com/containers/libpod/cmd/podman/common"
"github.com/containers/libpod/cmd/podman/registry"
"github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/domain/entities"
@@ -19,7 +20,7 @@ import (
var (
versionCommand = &cobra.Command{
Use: "version",
- Args: cobra.NoArgs,
+ Args: common.NoArgs,
Short: "Display the Podman Version Information",
RunE: version,
Annotations: map[string]string{
diff --git a/cmd/podman/volumes/list.go b/cmd/podman/volumes/list.go
index 7f5a55b14..8cc6fb301 100644
--- a/cmd/podman/volumes/list.go
+++ b/cmd/podman/volumes/list.go
@@ -9,6 +9,7 @@ import (
"strings"
"text/tabwriter"
+ "github.com/containers/libpod/cmd/podman/common"
"github.com/containers/libpod/cmd/podman/registry"
"github.com/containers/libpod/pkg/domain/entities"
"github.com/pkg/errors"
@@ -24,7 +25,7 @@ and the output format can be changed to JSON or a user specified Go template.`
lsCommand = &cobra.Command{
Use: "ls",
Aliases: []string{"list"},
- Args: cobra.NoArgs,
+ Args: common.NoArgs,
Short: "List volumes",
Long: volumeLsDescription,
RunE: list,
diff --git a/cmd/podman/volumes/prune.go b/cmd/podman/volumes/prune.go
index 197a9da9b..77138f4b7 100644
--- a/cmd/podman/volumes/prune.go
+++ b/cmd/podman/volumes/prune.go
@@ -7,6 +7,7 @@ import (
"os"
"strings"
+ "github.com/containers/libpod/cmd/podman/common"
"github.com/containers/libpod/cmd/podman/registry"
"github.com/containers/libpod/cmd/podman/utils"
"github.com/containers/libpod/pkg/domain/entities"
@@ -21,7 +22,7 @@ var (
Note all data will be destroyed.`
pruneCommand = &cobra.Command{
Use: "prune",
- Args: cobra.NoArgs,
+ Args: common.NoArgs,
Short: "Remove all unused volumes",
Long: volumePruneDescription,
RunE: prune,