diff options
author | Matthew Heon <mheon@redhat.com> | 2020-07-13 14:22:43 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2020-07-22 14:19:50 -0400 |
commit | 31ecb728d21b155ece248ec44afab59e1d61437e (patch) | |
tree | e0e01dcd516f08240fa8fdbe5356767263cbafb6 /libpod/networking_linux.go | |
parent | 11f716094cf2f6654d0ea4ee75e2a0bedb18900c (diff) | |
download | podman-31ecb728d21b155ece248ec44afab59e1d61437e.tar.gz podman-31ecb728d21b155ece248ec44afab59e1d61437e.tar.bz2 podman-31ecb728d21b155ece248ec44afab59e1d61437e.zip |
Include infra container information in `pod inspect`
We had a field for this in the inspect data, but it was never
being populated. Because of this, `podman pod inspect` stopped
showing port bindings (and other infra container settings). Add
code to populate the infra container inspect data, and add a test
to ensure we don't regress again.
Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'libpod/networking_linux.go')
-rw-r--r-- | libpod/networking_linux.go | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go index 7985e17e1..5cc282f3a 100644 --- a/libpod/networking_linux.go +++ b/libpod/networking_linux.go @@ -587,21 +587,7 @@ func getContainerNetIO(ctr *Container) (*netlink.LinkStatistics, error) { // network. func (c *Container) getContainerNetworkInfo() (*define.InspectNetworkSettings, error) { settings := new(define.InspectNetworkSettings) - settings.Ports = make(map[string][]define.InspectHostPort) - if c.config.PortMappings != nil { - for _, port := range c.config.PortMappings { - key := fmt.Sprintf("%d/%s", port.ContainerPort, port.Protocol) - mapping := settings.Ports[key] - if mapping == nil { - mapping = []define.InspectHostPort{} - } - mapping = append(mapping, define.InspectHostPort{ - HostIP: port.HostIP, - HostPort: fmt.Sprintf("%d", port.HostPort), - }) - settings.Ports[key] = mapping - } - } + settings.Ports = makeInspectPortBindings(c.config.PortMappings) // We can't do more if the network is down. if c.state.NetNS == nil { |