diff options
Diffstat (limited to 'pkg/specgen/pod_validate.go')
-rw-r--r-- | pkg/specgen/pod_validate.go | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/pkg/specgen/pod_validate.go b/pkg/specgen/pod_validate.go index 98d59549e..640447e71 100644 --- a/pkg/specgen/pod_validate.go +++ b/pkg/specgen/pod_validate.go @@ -1,7 +1,6 @@ package specgen import ( - "github.com/containers/libpod/pkg/rootless" "github.com/containers/libpod/pkg/util" "github.com/pkg/errors" ) @@ -33,12 +32,12 @@ func (p *PodSpecGenerator) Validate() error { } // PodNetworkConfig - if err := p.NetNS.validate(); err != nil { + if err := validateNetNS(&p.NetNS); err != nil { return err } if p.NoInfra { - if p.NetNS.NSMode == NoNetwork { - return errors.New("NoInfra and a none network cannot be used toegther") + if p.NetNS.NSMode != Default && p.NetNS.NSMode != "" { + return errors.New("NoInfra and network modes cannot be used toegther") } if p.StaticIP != nil { return exclusivePodOptions("NoInfra", "StaticIP") @@ -85,18 +84,7 @@ func (p *PodSpecGenerator) Validate() error { return exclusivePodOptions("NoManageHosts", "HostAdd") } - if err := p.NetNS.validate(); err != nil { - return err - } - // Set Defaults - if p.NetNS.Value == "" { - if rootless.IsRootless() { - p.NetNS.NSMode = Slirp - } else { - p.NetNS.NSMode = Bridge - } - } if len(p.InfraImage) < 1 { p.InfraImage = containerConfig.Engine.InfraImage } |