summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2018-03-15 16:23:48 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-03-16 13:55:49 +0000
commitcfdfb751a36d8975d56cebe38be682bd9d3308c8 (patch)
tree32d8860455b3c29a57ca100a2ae5f8a4495d4968 /cmd
parent358f84ad39048729454f343c3bf0987188d7b167 (diff)
downloadpodman-cfdfb751a36d8975d56cebe38be682bd9d3308c8.tar.gz
podman-cfdfb751a36d8975d56cebe38be682bd9d3308c8.tar.bz2
podman-cfdfb751a36d8975d56cebe38be682bd9d3308c8.zip
Address review comments
Signed-off-by: Matthew Heon <mheon@redhat.com> Closes: #503 Approved by: rhatdan
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/restart.go21
1 files changed, 13 insertions, 8 deletions
diff --git a/cmd/podman/restart.go b/cmd/podman/restart.go
index f96959a27..84aa5f830 100644
--- a/cmd/podman/restart.go
+++ b/cmd/podman/restart.go
@@ -58,7 +58,12 @@ func restartCmd(c *cli.Context) error {
if err != nil {
lastError = errors.Wrapf(err, "unable to get latest container")
} else {
- lastError = restartCtr(timeout, useTimeout, lastCtr)
+ ctrTimeout := lastCtr.StopTimeout()
+ if useTimeout {
+ ctrTimeout = timeout
+ }
+
+ lastError = restartCtr(ctrTimeout, lastCtr)
}
}
@@ -72,7 +77,12 @@ func restartCmd(c *cli.Context) error {
continue
}
- if err := restartCtr(timeout, useTimeout, ctr); err != nil {
+ ctrTimeout := ctr.StopTimeout()
+ if useTimeout {
+ ctrTimeout = timeout
+ }
+
+ if err := restartCtr(ctrTimeout, ctr); err != nil {
if lastError != nil {
fmt.Fprintln(os.Stderr, lastError)
}
@@ -84,12 +94,7 @@ func restartCmd(c *cli.Context) error {
}
// Restart a single container
-func restartCtr(cliTimeout uint, useTimeout bool, ctr *libpod.Container) error {
- timeout := ctr.StopTimeout()
- if useTimeout {
- timeout = cliTimeout
- }
-
+func restartCtr(timeout uint, ctr *libpod.Container) error {
state, err := ctr.State()
if err != nil {
return err