diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-03-03 11:13:22 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-03 11:13:22 -0500 |
commit | 8a1955f4191ad2cfac4ad13d9f48293054d65e92 (patch) | |
tree | 35172cd03bff4994321cdb5578ab93f494fb9a3c /pkg/api/handlers/compat | |
parent | 259bb5f7232432bce103c64cf1e68539ab7012e2 (diff) | |
parent | 8f2192922d105d6bbcae1fdc6fe0369da07a33aa (diff) | |
download | podman-8a1955f4191ad2cfac4ad13d9f48293054d65e92.tar.gz podman-8a1955f4191ad2cfac4ad13d9f48293054d65e92.tar.bz2 podman-8a1955f4191ad2cfac4ad13d9f48293054d65e92.zip |
Merge pull request #9581 from baude/issue9529
Add network summary to compat ps
Diffstat (limited to 'pkg/api/handlers/compat')
-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{}, |