summaryrefslogtreecommitdiff
path: root/libpod/networking_linux.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-02-22 16:56:43 -0500
committerGitHub <noreply@github.com>2021-02-22 16:56:43 -0500
commitd999328920ce826e5d1ef824c811374bb65ce26b (patch)
tree12952a1caffc6e2bfae40ec17ff36a66521b16d3 /libpod/networking_linux.go
parentc69decc305d746066824701ff073d5b34b744693 (diff)
parent9d818be7329929b05b93e432c408ee65726ec2c0 (diff)
downloadpodman-d999328920ce826e5d1ef824c811374bb65ce26b.tar.gz
podman-d999328920ce826e5d1ef824c811374bb65ce26b.tar.bz2
podman-d999328920ce826e5d1ef824c811374bb65ce26b.zip
Merge pull request #9455 from Luap99/fix-network-ids
Fix podman network IDs handling
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()