summaryrefslogtreecommitdiff
path: root/cmd/podman/restart.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-04-27 14:00:32 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-05-03 17:31:33 +0000
commit8dfebd4607c1152bd26c4a586e6d56a196c56e54 (patch)
treee4fdfcc0b1813fccd2ee6134931afbf2725a8208 /cmd/podman/restart.go
parentfae5033a01b78d3e8f23c1c9438bc5534dfe0fa3 (diff)
downloadpodman-8dfebd4607c1152bd26c4a586e6d56a196c56e54.tar.gz
podman-8dfebd4607c1152bd26c4a586e6d56a196c56e54.tar.bz2
podman-8dfebd4607c1152bd26c4a586e6d56a196c56e54.zip
varlink containers
first pass at adding in the container related endpoints/methods for the libpod backend. Couple of important notes: * endpoints that can use a console are not going to be done until we have "remote" console * several of the container methods should probably be able to stream as opposed to a one-off return Signed-off-by: baude <bbaude@redhat.com> Closes: #708 Approved by: baude
Diffstat (limited to 'cmd/podman/restart.go')
-rw-r--r--cmd/podman/restart.go26
1 files changed, 3 insertions, 23 deletions
diff --git a/cmd/podman/restart.go b/cmd/podman/restart.go
index e01a76fd0..08e8b615b 100644
--- a/cmd/podman/restart.go
+++ b/cmd/podman/restart.go
@@ -1,6 +1,7 @@
package main
import (
+ "context"
"fmt"
"os"
@@ -64,7 +65,7 @@ func restartCmd(c *cli.Context) error {
ctrTimeout = timeout
}
- lastError = restartCtr(ctrTimeout, lastCtr)
+ lastError = lastCtr.RestartWithTimeout(context.TODO(), ctrTimeout)
}
}
@@ -83,7 +84,7 @@ func restartCmd(c *cli.Context) error {
ctrTimeout = timeout
}
- if err := restartCtr(ctrTimeout, ctr); err != nil {
+ if err := ctr.RestartWithTimeout(context.TODO(), ctrTimeout); err != nil {
if lastError != nil {
fmt.Fprintln(os.Stderr, lastError)
}
@@ -93,24 +94,3 @@ func restartCmd(c *cli.Context) error {
return lastError
}
-
-// Restart a single container
-func restartCtr(timeout uint, ctr *libpod.Container) error {
- state, err := ctr.State()
- if err != nil {
- return err
- }
- if state == libpod.ContainerStateRunning {
- if err := ctr.StopWithTimeout(timeout); err != nil {
- return err
- }
- }
-
- if err := ctr.Start(getContext()); err != nil {
- return err
- }
-
- fmt.Printf("%s\n", ctr.ID())
-
- return nil
-}