summaryrefslogtreecommitdiff
path: root/cmd/podman/stop.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-11-07 13:20:43 -0600
committerbaude <bbaude@redhat.com>2018-11-08 15:18:11 -0600
commit2dd9cae37cb076418393ba61c0fb7b8cf97148f3 (patch)
tree346e95940f263a5ea770be6f11ebe4130e8e626b /cmd/podman/stop.go
parentfa8cc1a94281aac1c52952a002f9c3dd31d91197 (diff)
downloadpodman-2dd9cae37cb076418393ba61c0fb7b8cf97148f3.tar.gz
podman-2dd9cae37cb076418393ba61c0fb7b8cf97148f3.tar.bz2
podman-2dd9cae37cb076418393ba61c0fb7b8cf97148f3.zip
rm -f now removes a paused container
We now can remove a paused container by sending it a kill signal while it is paused. We then unpause the container and it is immediately killed. Also, reworked how the parallelWorker results are handled to provide a more consistent approach to how each subcommand implements it. It also fixes a bug where if one container errors, the error message is duplicated when printed out. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman/stop.go')
-rw-r--r--cmd/podman/stop.go23
1 files changed, 9 insertions, 14 deletions
diff --git a/cmd/podman/stop.go b/cmd/podman/stop.go
index cb36fd5cd..04022839a 100644
--- a/cmd/podman/stop.go
+++ b/cmd/podman/stop.go
@@ -59,7 +59,13 @@ func stopCmd(c *cli.Context) error {
}
defer runtime.Shutdown(false)
- containers, lastError := getAllOrLatestContainers(c, runtime, libpod.ContainerStateRunning, "running")
+ containers, err := getAllOrLatestContainers(c, runtime, libpod.ContainerStateRunning, "running")
+ if err != nil {
+ if len(containers) == 0 {
+ return err
+ }
+ fmt.Println(err.Error())
+ }
var stopFuncs []shared.ParallelWorkerInput
for _, ctr := range containers {
@@ -85,17 +91,6 @@ func stopCmd(c *cli.Context) error {
}
logrus.Debugf("Setting maximum workers to %d", maxWorkers)
- stopErrors := shared.ParallelExecuteWorkerPool(maxWorkers, stopFuncs)
-
- for cid, result := range stopErrors {
- if result != nil && result != libpod.ErrCtrStopped {
- if len(stopErrors) > 1 {
- fmt.Println(result.Error())
- }
- lastError = result
- continue
- }
- fmt.Println(cid)
- }
- return lastError
+ stopErrors, errCount := shared.ParallelExecuteWorkerPool(maxWorkers, stopFuncs)
+ return printParallelOutput(stopErrors, errCount)
}