summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-02-23 14:53:26 -0500
committerGitHub <noreply@github.com>2021-02-23 14:53:26 -0500
commitca0af71befa7e8408d83c59511e289cb57cf3c6d (patch)
tree2823cf9123dbb8e082fcc83fc098d28cf63fe2a0 /pkg
parent4dfcd585243b1695d36ac2a1a90dcb9818773511 (diff)
parente5ac28f3b968661e5c2603880a5c4576d590f3dd (diff)
downloadpodman-ca0af71befa7e8408d83c59511e289cb57cf3c6d.tar.gz
podman-ca0af71befa7e8408d83c59511e289cb57cf3c6d.tar.bz2
podman-ca0af71befa7e8408d83c59511e289cb57cf3c6d.zip
Merge pull request #9485 from vrothberg/fix-9479
container removal: handle already removed containers
Diffstat (limited to 'pkg')
-rw-r--r--pkg/domain/infra/abi/containers.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index 938a5a92b..4790bd58c 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -319,12 +319,18 @@ func (ic *ContainerEngine) ContainerRm(ctx context.Context, namesOrIds []string,
errMap, err := parallelctr.ContainerOp(ctx, ctrs, func(c *libpod.Container) error {
err := ic.Libpod.RemoveContainer(ctx, c, options.Force, options.Volumes)
- if err != nil {
- if options.Ignore && errors.Cause(err) == define.ErrNoSuchCtr {
+ if err == nil {
+ return nil
+ }
+ logrus.Debugf("Failed to remove container %s: %s", c.ID(), err.Error())
+ switch errors.Cause(err) {
+ case define.ErrNoSuchCtr:
+ if options.Ignore {
logrus.Debugf("Ignoring error (--allow-missing): %v", err)
return nil
}
- logrus.Debugf("Failed to remove container %s: %s", c.ID(), err.Error())
+ case define.ErrCtrRemoved:
+ return nil
}
return err
})