summaryrefslogtreecommitdiff
path: root/libpod/container.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2020-11-11 09:45:07 -0600
committerbaude <bbaude@redhat.com>2020-11-17 14:22:39 -0600
commitd3e794bda39167b15c5dc14d83333d1306316b11 (patch)
tree734cda964a2d46316f6aeb279be28fea541b32f5 /libpod/container.go
parent3a172c5999706e4493824c436bd7e2e8ea7b3d59 (diff)
downloadpodman-d3e794bda39167b15c5dc14d83333d1306316b11.tar.gz
podman-d3e794bda39167b15c5dc14d83333d1306316b11.tar.bz2
podman-d3e794bda39167b15c5dc14d83333d1306316b11.zip
add network connect|disconnect compat endpoints
this enables the ability to connect and disconnect a container from a given network. it is only for the compatibility layer. some code had to be refactored to avoid circular imports. additionally, tests are being deferred temporarily due to some incompatibility/bug in either docker-py or our stack. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'libpod/container.go')
-rw-r--r--libpod/container.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/libpod/container.go b/libpod/container.go
index 333e1d848..9009a4ec8 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -1088,3 +1088,17 @@ func (c *Container) networks() ([]string, error) {
return networks, err
}
+
+// networksByNameIndex provides us with a map of container networks where key
+// is network name and value is the index position
+func (c *Container) networksByNameIndex() (map[string]int, error) {
+ networks, err := c.networks()
+ if err != nil {
+ return nil, err
+ }
+ networkNamesByIndex := make(map[string]int, len(networks))
+ for index, name := range networks {
+ networkNamesByIndex[name] = index
+ }
+ return networkNamesByIndex, nil
+}