diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-11-17 23:18:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-17 23:18:48 +0100 |
commit | 8a0c3d878b13d86b97da188bda1fe580dbb07b8f (patch) | |
tree | d7fa4be266bd8a79008c45c8f357a856eb107003 /libpod/container.go | |
parent | 0f745272e79daa496e541ff18bc6e21339559f38 (diff) | |
parent | d3e794bda39167b15c5dc14d83333d1306316b11 (diff) | |
download | podman-8a0c3d878b13d86b97da188bda1fe580dbb07b8f.tar.gz podman-8a0c3d878b13d86b97da188bda1fe580dbb07b8f.tar.bz2 podman-8a0c3d878b13d86b97da188bda1fe580dbb07b8f.zip |
Merge pull request #8355 from baude/compatnetworkconnectdisconnect
add network connect|disconnect compat endpoints
Diffstat (limited to 'libpod/container.go')
-rw-r--r-- | libpod/container.go | 14 |
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 +} |