From 52ea0deee64c7466635452c62354604bdc7b48b4 Mon Sep 17 00:00:00 2001 From: baude Date: Fri, 24 Nov 2017 09:08:59 -0600 Subject: kpod_wait Convert to libpod container backend Signed-off-by: baude Closes: #70 Approved by: rhatdan --- cmd/kpod/wait.go | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'cmd/kpod') 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) -- cgit v1.2.3-54-g00ecf