From 28bead8be8eb541cf0c78e6ee3a3963adc8d1d3a Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Wed, 28 Nov 2018 12:48:58 -0500 Subject: Add --sync flag to podman ps The previous commit added support for --sync to podman rm to ensure state inconsistencies would not prevent containers from being removed. Add the flag to podman ps as well, so that all containers can be forcibly synced and all state inconsistencies resolved. Signed-off-by: Matthew Heon --- cmd/podman/shared/container.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cmd/podman/shared') diff --git a/cmd/podman/shared/container.go b/cmd/podman/shared/container.go index d0e892961..90ce193f7 100644 --- a/cmd/podman/shared/container.go +++ b/cmd/podman/shared/container.go @@ -45,6 +45,7 @@ type PsOptions struct { Sort string Label string Namespace bool + Sync bool } // BatchContainerStruct is the return obkect from BatchContainer and contains @@ -126,6 +127,12 @@ func NewBatchContainer(ctr *libpod.Container, opts PsOptions) (PsContainerOutput pso PsContainerOutput ) batchErr := ctr.Batch(func(c *libpod.Container) error { + if opts.Sync { + if err := c.Sync(); err != nil { + return err + } + } + conState, err = c.State() if err != nil { return errors.Wrapf(err, "unable to obtain container state") -- cgit v1.2.3-54-g00ecf