summaryrefslogtreecommitdiff
path: root/cmd/kpod/wait.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2017-11-24 09:08:59 -0600
committerAtomic Bot <atomic-devel@projectatomic.io>2017-11-27 19:05:59 +0000
commit52ea0deee64c7466635452c62354604bdc7b48b4 (patch)
treef2c49a453f51370d6eb9da6c186117b33480e8fa /cmd/kpod/wait.go
parent99f905243be351c4ca3c878dfe1a86e38169569d (diff)
downloadpodman-52ea0deee64c7466635452c62354604bdc7b48b4.tar.gz
podman-52ea0deee64c7466635452c62354604bdc7b48b4.tar.bz2
podman-52ea0deee64c7466635452c62354604bdc7b48b4.zip
kpod_wait
Convert to libpod container backend Signed-off-by: baude <bbaude@redhat.com> Closes: #70 Approved by: rhatdan
Diffstat (limited to 'cmd/kpod/wait.go')
-rw-r--r--cmd/kpod/wait.go21
1 files changed, 10 insertions, 11 deletions
diff --git a/cmd/kpod/wait.go b/cmd/kpod/wait.go
index 5e8a50e13..6e22f54e5 100644
--- a/cmd/kpod/wait.go
+++ b/cmd/kpod/wait.go
@@ -5,7 +5,6 @@ import (
"os"
"github.com/pkg/errors"
- "github.com/projectatomic/libpod/libkpod"
"github.com/urfave/cli"
)
@@ -31,23 +30,23 @@ func waitCmd(c *cli.Context) error {
return errors.Errorf("you must provide at least one container name or id")
}
- config, err := getConfig(c)
+ runtime, err := getRuntime(c)
if err != nil {
- return errors.Wrapf(err, "could not get config")
- }
- server, err := libkpod.New(config)
- if err != nil {
- return errors.Wrapf(err, "could not get container server")
+ return errors.Wrapf(err, "error creating libpod runtime")
}
- defer server.Shutdown()
- err = server.Update()
+ defer runtime.Shutdown(false)
+
if err != nil {
- return errors.Wrapf(err, "could not update list of containers")
+ return errors.Wrapf(err, "could not get config")
}
var lastError error
for _, container := range c.Args() {
- returnCode, err := server.ContainerWait(container)
+ ctr, err := runtime.LookupContainer(container)
+ if err != nil {
+ return errors.Wrapf(err, "unable to find container %s", container)
+ }
+ returnCode, err := ctr.Wait()
if err != nil {
if lastError != nil {
fmt.Fprintln(os.Stderr, lastError)