aboutsummaryrefslogtreecommitdiff
path: root/libpod/pod_api.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-12-15 15:25:14 +0100
committerGitHub <noreply@github.com>2021-12-15 15:25:14 +0100
commit7dabcbd7bcf78f3b5d310ed547801106da382618 (patch)
tree7b92c3ca37025a833a0d9651afeb19ba7c903cc8 /libpod/pod_api.go
parentb01a421f3413ba01b2c189b82c8153bdbd2a05fb (diff)
parentef325bc8c4824537e4bfb21aa7e6114a6e5a8c09 (diff)
downloadpodman-7dabcbd7bcf78f3b5d310ed547801106da382618.tar.gz
podman-7dabcbd7bcf78f3b5d310ed547801106da382618.tar.bz2
podman-7dabcbd7bcf78f3b5d310ed547801106da382618.zip
Merge pull request #12534 from Luap99/network-db
network db rewrite
Diffstat (limited to 'libpod/pod_api.go')
-rw-r--r--libpod/pod_api.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/libpod/pod_api.go b/libpod/pod_api.go
index 80ecb690a..95a82721e 100644
--- a/libpod/pod_api.go
+++ b/libpod/pod_api.go
@@ -637,9 +637,17 @@ func (p *Pod) Inspect() (*define.InspectPodData, error) {
infraConfig.HostAdd = make([]string, 0, len(infra.config.HostAdd))
infraConfig.HostAdd = append(infraConfig.HostAdd, infra.config.HostAdd...)
}
- if len(infra.config.ContainerNetworkConfig.Networks) > 0 {
- infraConfig.Networks = make([]string, 0, len(infra.config.ContainerNetworkConfig.Networks))
- infraConfig.Networks = append(infraConfig.Networks, infra.config.ContainerNetworkConfig.Networks...)
+
+ networks, err := infra.networks()
+ if err != nil {
+ return nil, err
+ }
+ netNames := make([]string, 0, len(networks))
+ for name := range networks {
+ netNames = append(netNames, name)
+ }
+ if len(netNames) > 0 {
+ infraConfig.Networks = netNames
}
infraConfig.NetworkOptions = infra.config.ContainerNetworkConfig.NetworkOptions
infraConfig.PortBindings = makeInspectPortBindings(infra.config.ContainerNetworkConfig.PortMappings, nil)