summaryrefslogtreecommitdiff
path: root/cmd/podman/stop.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-02-28 03:54:53 +0100
committerGitHub <noreply@github.com>2019-02-28 03:54:53 +0100
commitbbf54aaab7a4dacbbeec37a76126d953b47ef98a (patch)
tree50fd9e340d96b2fa560f85da6c12b3fb9771329a /cmd/podman/stop.go
parent6f0dbd004fecadb6d0d07bb8012231d25d61684f (diff)
parent37f447d78ec88267f81c6eb3843a63bf9f36e268 (diff)
downloadpodman-bbf54aaab7a4dacbbeec37a76126d953b47ef98a.tar.gz
podman-bbf54aaab7a4dacbbeec37a76126d953b47ef98a.tar.bz2
podman-bbf54aaab7a4dacbbeec37a76126d953b47ef98a.zip
Merge pull request #2476 from mheon/fix_stop
Fix ignored --stop-timeout flag to 'podman create'
Diffstat (limited to 'cmd/podman/stop.go')
-rw-r--r--cmd/podman/stop.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/cmd/podman/stop.go b/cmd/podman/stop.go
index d86894a6f..ab9a2cf38 100644
--- a/cmd/podman/stop.go
+++ b/cmd/podman/stop.go
@@ -73,21 +73,29 @@ func stopCmd(c *cliconfig.StopValues) error {
fmt.Println(err.Error())
}
+ if c.Flag("timeout").Changed && c.Flag("time").Changed {
+ return errors.New("the --timeout and --time flags are mutually exclusive")
+ }
+
var stopFuncs []shared.ParallelWorkerInput
for _, ctr := range containers {
con := ctr
var stopTimeout uint
- if c.Flag("timeout").Changed {
+ if c.Flag("timeout").Changed || c.Flag("time").Changed {
stopTimeout = c.Timeout
} else {
stopTimeout = ctr.StopTimeout()
+ logrus.Debugf("Set timeout to container %s default (%d)", ctr.ID(), stopTimeout)
}
f := func() error {
- if err := con.StopWithTimeout(stopTimeout); err != nil && errors.Cause(err) != libpod.ErrCtrStopped {
+ if err := con.StopWithTimeout(stopTimeout); err != nil {
+ if errors.Cause(err) == libpod.ErrCtrStopped {
+ logrus.Debugf("Container %s already stopped", con.ID())
+ return nil
+ }
return err
}
return nil
-
}
stopFuncs = append(stopFuncs, shared.ParallelWorkerInput{
ContainerID: con.ID(),