summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi/containers.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/domain/infra/abi/containers.go')
-rw-r--r--pkg/domain/infra/abi/containers.go48
1 files changed, 27 insertions, 21 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index 0ee4048d1..4790bd58c 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -12,24 +12,24 @@ import (
"github.com/containers/buildah"
"github.com/containers/common/pkg/config"
"github.com/containers/image/v5/manifest"
- "github.com/containers/podman/v2/libpod"
- "github.com/containers/podman/v2/libpod/define"
- "github.com/containers/podman/v2/libpod/events"
- "github.com/containers/podman/v2/libpod/image"
- "github.com/containers/podman/v2/libpod/logs"
- "github.com/containers/podman/v2/pkg/cgroups"
- "github.com/containers/podman/v2/pkg/checkpoint"
- "github.com/containers/podman/v2/pkg/domain/entities"
- "github.com/containers/podman/v2/pkg/domain/entities/reports"
- dfilters "github.com/containers/podman/v2/pkg/domain/filters"
- "github.com/containers/podman/v2/pkg/domain/infra/abi/terminal"
- parallelctr "github.com/containers/podman/v2/pkg/parallel/ctr"
- "github.com/containers/podman/v2/pkg/ps"
- "github.com/containers/podman/v2/pkg/rootless"
- "github.com/containers/podman/v2/pkg/signal"
- "github.com/containers/podman/v2/pkg/specgen"
- "github.com/containers/podman/v2/pkg/specgen/generate"
- "github.com/containers/podman/v2/pkg/util"
+ "github.com/containers/podman/v3/libpod"
+ "github.com/containers/podman/v3/libpod/define"
+ "github.com/containers/podman/v3/libpod/events"
+ "github.com/containers/podman/v3/libpod/image"
+ "github.com/containers/podman/v3/libpod/logs"
+ "github.com/containers/podman/v3/pkg/cgroups"
+ "github.com/containers/podman/v3/pkg/checkpoint"
+ "github.com/containers/podman/v3/pkg/domain/entities"
+ "github.com/containers/podman/v3/pkg/domain/entities/reports"
+ dfilters "github.com/containers/podman/v3/pkg/domain/filters"
+ "github.com/containers/podman/v3/pkg/domain/infra/abi/terminal"
+ parallelctr "github.com/containers/podman/v3/pkg/parallel/ctr"
+ "github.com/containers/podman/v3/pkg/ps"
+ "github.com/containers/podman/v3/pkg/rootless"
+ "github.com/containers/podman/v3/pkg/signal"
+ "github.com/containers/podman/v3/pkg/specgen"
+ "github.com/containers/podman/v3/pkg/specgen/generate"
+ "github.com/containers/podman/v3/pkg/util"
"github.com/containers/storage"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -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
})