aboutsummaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2021-01-25 13:58:04 -0600
committerMatthew Heon <matthew.heon@pm.me>2021-01-26 16:00:06 -0500
commit02ec5299f619494d9e194492b6d3266daf0a5a6c (patch)
treed5f1a52ff9628d148e1088093d00d8fe7f4277c7 /libpod
parent5d444466e1b55edbf48a2ad4999d4564bc20d01f (diff)
downloadpodman-02ec5299f619494d9e194492b6d3266daf0a5a6c.tar.gz
podman-02ec5299f619494d9e194492b6d3266daf0a5a6c.tar.bz2
podman-02ec5299f619494d9e194492b6d3266daf0a5a6c.zip
Add default net info in container inspect
when inspecting a container that is only connected to the default network, we should populate the default network in the container inspect information. Fixes: #6618 Signed-off-by: baude <bbaude@redhat.com> MH: Small fixes, added another test Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/networking_linux.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go
index ef2f034ab..737dbf935 100644
--- a/libpod/networking_linux.go
+++ b/libpod/networking_linux.go
@@ -977,7 +977,7 @@ func (c *Container) getContainerNetworkInfo() (*define.InspectNetworkSettings, e
if c.state.NetNS == nil {
// We still want to make dummy configurations for each CNI net
// the container joined.
- if len(networks) > 0 && !isDefault {
+ if len(networks) > 0 {
settings.Networks = make(map[string]*define.InspectAdditionalNetwork, len(networks))
for _, net := range networks {
cniNet := new(define.InspectAdditionalNetwork)
@@ -998,7 +998,7 @@ func (c *Container) getContainerNetworkInfo() (*define.InspectNetworkSettings, e
}
// If we have CNI networks - handle that here
- if len(networks) > 0 && !isDefault {
+ if len(networks) > 0 {
if len(networks) != len(c.state.NetworkStatus) {
return nil, errors.Wrapf(define.ErrInternal, "network inspection mismatch: asked to join %d CNI network(s) %v, but have information on %d network(s)", len(networks), networks, len(c.state.NetworkStatus))
}
@@ -1028,7 +1028,9 @@ func (c *Container) getContainerNetworkInfo() (*define.InspectNetworkSettings, e
settings.Networks[name] = addedNet
}
- return settings, nil
+ if !isDefault {
+ return settings, nil
+ }
}
// If not joining networks, we should have at most 1 result