summaryrefslogtreecommitdiff
path: root/pkg/spec
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-02-25 21:31:50 +0100
committerGitHub <noreply@github.com>2019-02-25 21:31:50 +0100
commite45c44208067f4ac26c5136842d5a17478f5234c (patch)
treedeef90c9c3b502d137a64135ed0f125fbaeeb38b /pkg/spec
parent6fc18e7d07e8263faca8341efb0220bf4be4f417 (diff)
parentb87bdced1fa967846916b47cba5f093f72f3d11f (diff)
downloadpodman-e45c44208067f4ac26c5136842d5a17478f5234c.tar.gz
podman-e45c44208067f4ac26c5136842d5a17478f5234c.tar.bz2
podman-e45c44208067f4ac26c5136842d5a17478f5234c.zip
Merge pull request #2358 from rhatdan/namespace
Fix up handling of user defined network namespaces
Diffstat (limited to 'pkg/spec')
-rw-r--r--pkg/spec/createconfig.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/pkg/spec/createconfig.go b/pkg/spec/createconfig.go
index 8da44a2f0..50e07ee74 100644
--- a/pkg/spec/createconfig.go
+++ b/pkg/spec/createconfig.go
@@ -446,7 +446,15 @@ func (c *CreateConfig) GetContainerCreateOptions(runtime *libpod.Runtime, pod *l
}
if IsNS(string(c.NetMode)) {
- // pass
+ split := strings.SplitN(string(c.NetMode), ":", 2)
+ if len(split[0]) != 2 {
+ return nil, errors.Errorf("invalid user defined network namespace %q", c.NetMode.UserDefined())
+ }
+ _, err := os.Stat(split[1])
+ if err != nil {
+ return nil, err
+ }
+ options = append(options, libpod.WithNetNS(portBindings, false, string(c.NetMode), networks))
} else if c.NetMode.IsContainer() {
connectedCtr, err := c.Runtime.LookupContainer(c.NetMode.Container())
if err != nil {