From 38baf3d5e2bc5c1e8b216dc072ea1d3eaf5053b8 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Sat, 9 Jan 2021 16:54:41 +0100 Subject: Add Networks format placeholder to podman ps and pod ps `podman ps --format {{.Networks}}` will show all connected networks for this container. For `pod ps` it will show the infra container networks. Signed-off-by: Paul Holzinger --- pkg/domain/infra/abi/pods.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'pkg/domain/infra/abi/pods.go') diff --git a/pkg/domain/infra/abi/pods.go b/pkg/domain/infra/abi/pods.go index f108b770c..2a8445c9f 100644 --- a/pkg/domain/infra/abi/pods.go +++ b/pkg/domain/infra/abi/pods.go @@ -333,6 +333,17 @@ func (ic *ContainerEngine) PodPs(ctx context.Context, options entities.PodPSOpti if err != nil { return nil, err } + networks := []string{} + if len(infraID) > 0 { + infra, err := p.InfraContainer() + if err != nil { + return nil, err + } + networks, _, err = infra.Networks() + if err != nil { + return nil, err + } + } reports = append(reports, &entities.ListPodsReport{ Cgroup: p.CgroupParent(), Containers: lpcs, @@ -341,6 +352,7 @@ func (ic *ContainerEngine) PodPs(ctx context.Context, options entities.PodPSOpti InfraId: infraID, Name: p.Name(), Namespace: p.Namespace(), + Networks: networks, Status: status, Labels: p.Labels(), }) -- cgit v1.2.3-54-g00ecf