mirror of
https://github.com/containers/podman.git
synced 2025-06-08 16:28:51 +08:00
Address review comments
Signed-off-by: Matthew Heon <mheon@redhat.com> Closes: #503 Approved by: rhatdan
This commit is contained in:
@ -58,7 +58,12 @@ func restartCmd(c *cli.Context) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
lastError = errors.Wrapf(err, "unable to get latest container")
|
lastError = errors.Wrapf(err, "unable to get latest container")
|
||||||
} else {
|
} 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
|
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 {
|
if lastError != nil {
|
||||||
fmt.Fprintln(os.Stderr, lastError)
|
fmt.Fprintln(os.Stderr, lastError)
|
||||||
}
|
}
|
||||||
@ -84,12 +94,7 @@ func restartCmd(c *cli.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Restart a single container
|
// Restart a single container
|
||||||
func restartCtr(cliTimeout uint, useTimeout bool, ctr *libpod.Container) error {
|
func restartCtr(timeout uint, ctr *libpod.Container) error {
|
||||||
timeout := ctr.StopTimeout()
|
|
||||||
if useTimeout {
|
|
||||||
timeout = cliTimeout
|
|
||||||
}
|
|
||||||
|
|
||||||
state, err := ctr.State()
|
state, err := ctr.State()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Reference in New Issue
Block a user