summaryrefslogtreecommitdiff
path: root/cmd/podman/rm.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2018-11-09 10:28:14 -0800
committerGitHub <noreply@github.com>2018-11-09 10:28:14 -0800
commit78e6d8e7d70d431ccf096dee0f8eadb1c9b2967b (patch)
tree4adf8d4048a6b2c4c89ade6bb9375716d8fe8bd3 /cmd/podman/rm.go
parent7813f90ce623c8882e53171c8ffe7fb46664ead7 (diff)
parent2dd9cae37cb076418393ba61c0fb7b8cf97148f3 (diff)
downloadpodman-78e6d8e7d70d431ccf096dee0f8eadb1c9b2967b.tar.gz
podman-78e6d8e7d70d431ccf096dee0f8eadb1c9b2967b.tar.bz2
podman-78e6d8e7d70d431ccf096dee0f8eadb1c9b2967b.zip
Merge pull request #1772 from baude/rmdelpaused
rm -f now removes a paused container
Diffstat (limited to 'cmd/podman/rm.go')
-rw-r--r--cmd/podman/rm.go26
1 files changed, 11 insertions, 15 deletions
diff --git a/cmd/podman/rm.go b/cmd/podman/rm.go
index 0fb5345ee..7c0569b78 100644
--- a/cmd/podman/rm.go
+++ b/cmd/podman/rm.go
@@ -4,7 +4,6 @@ import (
"fmt"
"github.com/containers/libpod/cmd/podman/libpodruntime"
"github.com/containers/libpod/cmd/podman/shared"
- "github.com/containers/libpod/libpod"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
@@ -46,9 +45,7 @@ Running containers will not be removed without the -f option.
// saveCmd saves the image to either docker-archive or oci
func rmCmd(c *cli.Context) error {
var (
- delContainers []*libpod.Container
- lastError error
- deleteFuncs []shared.ParallelWorkerInput
+ deleteFuncs []shared.ParallelWorkerInput
)
ctx := getContext()
@@ -65,7 +62,13 @@ func rmCmd(c *cli.Context) error {
return err
}
- delContainers, lastError = getAllOrLatestContainers(c, runtime, -1, "all")
+ delContainers, err := getAllOrLatestContainers(c, runtime, -1, "all")
+ if err != nil {
+ if len(delContainers) == 0 {
+ return err
+ }
+ fmt.Println(err.Error())
+ }
for _, container := range delContainers {
con := container
@@ -84,14 +87,7 @@ func rmCmd(c *cli.Context) error {
}
logrus.Debugf("Setting maximum workers to %d", maxWorkers)
- deleteErrors := shared.ParallelExecuteWorkerPool(maxWorkers, deleteFuncs)
- for cid, result := range deleteErrors {
- if result != nil {
- fmt.Println(result.Error())
- lastError = result
- continue
- }
- fmt.Println(cid)
- }
- return lastError
+ // Run the parallel funcs
+ deleteErrors, errCount := shared.ParallelExecuteWorkerPool(maxWorkers, deleteFuncs)
+ return printParallelOutput(deleteErrors, errCount)
}