diff options
author | baude <bbaude@redhat.com> | 2021-03-02 14:56:01 -0600 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2021-03-03 08:16:58 -0600 |
commit | 8f2192922d105d6bbcae1fdc6fe0369da07a33aa (patch) | |
tree | a1a282e06057f7609b387733dee12bbba2605b30 /pkg/api/handlers/compat/containers.go | |
parent | 0c12478a387d31796214150ec82d4d8103ad303c (diff) | |
download | podman-8f2192922d105d6bbcae1fdc6fe0369da07a33aa.tar.gz podman-8f2192922d105d6bbcae1fdc6fe0369da07a33aa.tar.bz2 podman-8f2192922d105d6bbcae1fdc6fe0369da07a33aa.zip |
Add network summary to compat ps
The compatibility endpoint for listing containers should have the
summarized network configuration with it.
Fixes: #9529
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/api/handlers/compat/containers.go')
-rw-r--r-- | pkg/api/handlers/compat/containers.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go index 1e84888af..d26bb50f4 100644 --- a/pkg/api/handlers/compat/containers.go +++ b/pkg/api/handlers/compat/containers.go @@ -321,6 +321,19 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error Type: portMapping.Protocol, } } + inspect, err := l.Inspect(false) + if err != nil { + return nil, err + } + + n, err := json.Marshal(inspect.NetworkSettings) + if err != nil { + return nil, err + } + networkSettings := types.SummaryNetworkSettings{} + if err := json.Unmarshal(n, &networkSettings); err != nil { + return nil, err + } return &handlers.Container{Container: types.Container{ ID: l.ID(), @@ -339,7 +352,7 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error NetworkMode string `json:",omitempty"` }{ "host"}, - NetworkSettings: nil, + NetworkSettings: &networkSettings, Mounts: nil, }, ContainerCreateConfig: types.ContainerCreateConfig{}, |