summaryrefslogtreecommitdiff
path: root/pkg/specgen
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-11-30 19:43:19 +0100
committerGitHub <noreply@github.com>2020-11-30 19:43:19 +0100
commit1613921ecc8e54a6d2ca6008a54ef16314bbb587 (patch)
treebd7471389cf3f1e42f56cc0f3fc26280c20f8117 /pkg/specgen
parentf24812ac3ba969bc5a0628b819699d747c853e36 (diff)
parentf3402c73d4a21dca68573babb3554c13cb878505 (diff)
downloadpodman-1613921ecc8e54a6d2ca6008a54ef16314bbb587.tar.gz
podman-1613921ecc8e54a6d2ca6008a54ef16314bbb587.tar.bz2
podman-1613921ecc8e54a6d2ca6008a54ef16314bbb587.zip
Merge pull request #8514 from Luap99/revert-8410-fix-multiple-networks
Revert "Allow multiple --network flags for podman run/create"
Diffstat (limited to 'pkg/specgen')
-rw-r--r--pkg/specgen/namespaces.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/specgen/namespaces.go b/pkg/specgen/namespaces.go
index 9f0dd80de..d15745fa0 100644
--- a/pkg/specgen/namespaces.go
+++ b/pkg/specgen/namespaces.go
@@ -278,10 +278,16 @@ func ParseNetworkNamespace(ns string) (Namespace, []string, error) {
toReturn.NSMode = Private
case strings.HasPrefix(ns, "ns:"):
split := strings.SplitN(ns, ":", 2)
+ if len(split) != 2 {
+ return toReturn, nil, errors.Errorf("must provide a path to a namespace when specifying ns:")
+ }
toReturn.NSMode = Path
toReturn.Value = split[1]
case strings.HasPrefix(ns, "container:"):
split := strings.SplitN(ns, ":", 2)
+ if len(split) != 2 {
+ return toReturn, nil, errors.Errorf("must provide name or ID or a container when specifying container:")
+ }
toReturn.NSMode = FromContainer
toReturn.Value = split[1]
default: