summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-03-08 14:48:47 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-03-09 02:14:12 +0000
commit7516dfd8c5185346c49ab899f41c080547c3d107 (patch)
treefaf099cf19b03d9d9650934932ad45a9b92d1c58
parent984dfecb2c1293062edf4cbb77a2b4e115c81fd5 (diff)
downloadpodman-7516dfd8c5185346c49ab899f41c080547c3d107.tar.gz
podman-7516dfd8c5185346c49ab899f41c080547c3d107.tar.bz2
podman-7516dfd8c5185346c49ab899f41c080547c3d107.zip
Fix a potential race around container removal in ps
Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #467 Approved by: baude
-rw-r--r--cmd/podman/ps.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/cmd/podman/ps.go b/cmd/podman/ps.go
index 26991af4b..4dd7133bc 100644
--- a/cmd/podman/ps.go
+++ b/cmd/podman/ps.go
@@ -405,6 +405,14 @@ func getTemplateOutput(containers []*libpod.Container, opts psOptions) ([]psTemp
for _, ctr := range containers {
batchInfo, err := batchContainerOp(ctr, opts)
if err != nil {
+ // If the error was ErrNoSuchCtr, it was probably
+ // removed sometime after we got the initial list.
+ // Just ignore it.
+ if errors.Cause(err) == libpod.ErrNoSuchCtr {
+ logrus.Debugf("Container %s removed before batch, ignoring in output", ctr.ID())
+ continue
+ }
+
return nil, err
}
ctrID := ctr.ID()