diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-03-08 14:48:47 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-03-09 02:14:12 +0000 |
commit | 7516dfd8c5185346c49ab899f41c080547c3d107 (patch) | |
tree | faf099cf19b03d9d9650934932ad45a9b92d1c58 | |
parent | 984dfecb2c1293062edf4cbb77a2b4e115c81fd5 (diff) | |
download | podman-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.go | 8 |
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() |