summaryrefslogtreecommitdiff
path: root/cmd/podman/rm.go
diff options
context:
space:
mode:
authorDebarshi Ray <rishi@fedoraproject.org>2019-03-13 20:19:31 +0100
committerDebarshi Ray <rishi@fedoraproject.org>2019-03-15 18:28:47 +0100
commit082d792693504848e186a29db717ce20c7ff7774 (patch)
treed552982bc6501d6f3d74d9d7e244f5663aefd268 /cmd/podman/rm.go
parent8aed32acea9bb35898abcee58fc9aa2a03ef264a (diff)
downloadpodman-082d792693504848e186a29db717ce20c7ff7774.tar.gz
podman-082d792693504848e186a29db717ce20c7ff7774.tar.bz2
podman-082d792693504848e186a29db717ce20c7ff7774.zip
Make 'podman rm' exit with 125 if it had a bogus & a running container
Getting a list of containers, and then deleting them are two separate fallible steps that can run into different sets of errors. eg., in the case of a bogus missing container and a container that's running or paused, the first step will only trigger libpod.ErrNoSuchCtr. At this point it might appear that the exit code ought to be 1. However, when attempting the deletion, it will fail once more due to the status of the running or paused container. Since libpod.ErrNoSuchCtr is no longer the only error encountered, the exit code should be reset to 125. This problem is currently masked for rootless usage due to commit 35432ecaae4a8372 ("rootless: fix rm when uid in the container != 0"). Fixes: 85db895012bead6b ("rm: set exit code to 1 if a specified ...") e41279b902a334e5 ("Change exit code to 1 on podman rm ...") Signed-off-by: Debarshi Ray <rishi@fedoraproject.org>
Diffstat (limited to 'cmd/podman/rm.go')
-rw-r--r--cmd/podman/rm.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmd/podman/rm.go b/cmd/podman/rm.go
index 56aaae9eb..299420bb6 100644
--- a/cmd/podman/rm.go
+++ b/cmd/podman/rm.go
@@ -195,5 +195,10 @@ func rmCmd(c *cliconfig.RmValues) error {
exitCode = 1
}
}
+
+ if failureCnt > 0 {
+ exitCode = 125
+ }
+
return err
}