summaryrefslogtreecommitdiff
path: root/libpod/networking_linux.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/networking_linux.go')
-rw-r--r--libpod/networking_linux.go14
1 files changed, 6 insertions, 8 deletions
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go
index 5f9ad0e27..c1b2c694d 100644
--- a/libpod/networking_linux.go
+++ b/libpod/networking_linux.go
@@ -1139,13 +1139,12 @@ func (c *Container) NetworkDisconnect(nameOrID, netName string, force bool) erro
return err
}
- exists, err := network.Exists(c.runtime.config, netName)
+ // check if network exists and if the input is a ID we get the name
+ // ocicni only uses names so it is important that we only use the name
+ netName, err = network.NormalizeName(c.runtime.config, netName)
if err != nil {
return err
}
- if !exists {
- return errors.Wrap(define.ErrNoSuchNetwork, netName)
- }
index, nameExists := networks[netName]
if !nameExists && len(networks) > 0 {
@@ -1196,13 +1195,12 @@ func (c *Container) NetworkConnect(nameOrID, netName string, aliases []string) e
return err
}
- exists, err := network.Exists(c.runtime.config, netName)
+ // check if network exists and if the input is a ID we get the name
+ // ocicni only uses names so it is important that we only use the name
+ netName, err = network.NormalizeName(c.runtime.config, netName)
if err != nil {
return err
}
- if !exists {
- return errors.Wrap(define.ErrNoSuchNetwork, netName)
- }
c.lock.Lock()
defer c.lock.Unlock()