summaryrefslogtreecommitdiff
path: root/cmd/podman/networks
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-06-24 09:27:07 -0400
committerGitHub <noreply@github.com>2020-06-24 09:27:07 -0400
commitc48a5420135ecbff294e1fbce95be0adf9fc2931 (patch)
treeab0c8e41595adfbec664ffc7e9c7cbfdf6e51623 /cmd/podman/networks
parentb74238864fe4a6fe22f3a8a370e9a32ea21ee383 (diff)
parent6864a5547a774d19a7ccb9d50a7799b721fb66ef (diff)
downloadpodman-c48a5420135ecbff294e1fbce95be0adf9fc2931.tar.gz
podman-c48a5420135ecbff294e1fbce95be0adf9fc2931.tar.bz2
podman-c48a5420135ecbff294e1fbce95be0adf9fc2931.zip
Merge pull request #6733 from edsantiago/bats_help_extra_args
BATS tests: new too-many-arguments test
Diffstat (limited to 'cmd/podman/networks')
-rw-r--r--cmd/podman/networks/create.go12
-rw-r--r--cmd/podman/networks/inspect.go2
2 files changed, 5 insertions, 9 deletions
diff --git a/cmd/podman/networks/create.go b/cmd/podman/networks/create.go
index 5d28c7140..2d29beddd 100644
--- a/cmd/podman/networks/create.go
+++ b/cmd/podman/networks/create.go
@@ -8,7 +8,6 @@ import (
"github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/domain/entities"
"github.com/containers/libpod/pkg/network"
- "github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
@@ -20,6 +19,7 @@ var (
Short: "network create",
Long: networkCreateDescription,
RunE: networkCreate,
+ Args: cobra.MaximumNArgs(1),
Example: `podman network create podman1`,
Annotations: map[string]string{
registry.ParentNSRequired: "",
@@ -62,14 +62,10 @@ func networkCreate(cmd *cobra.Command, args []string) error {
if err := network.IsSupportedDriver(networkCreateOptions.Driver); err != nil {
return err
}
- if len(args) > 1 {
- return errors.Errorf("only one network can be created at a time")
- }
- if len(args) > 0 && !define.NameRegex.MatchString(args[0]) {
- return define.RegexError
- }
-
if len(args) > 0 {
+ if !define.NameRegex.MatchString(args[0]) {
+ return define.RegexError
+ }
name = args[0]
}
response, err := registry.ContainerEngine().NetworkCreate(registry.Context(), name, networkCreateOptions)
diff --git a/cmd/podman/networks/inspect.go b/cmd/podman/networks/inspect.go
index 1b2e89909..31269e836 100644
--- a/cmd/podman/networks/inspect.go
+++ b/cmd/podman/networks/inspect.go
@@ -16,7 +16,7 @@ import (
var (
networkinspectDescription = `Inspect network`
networkinspectCommand = &cobra.Command{
- Use: "inspect NETWORK [NETWORK...] [flags] ",
+ Use: "inspect [flags] NETWORK [NETWORK...]",
Short: "network inspect",
Long: networkinspectDescription,
RunE: networkInspect,