From b85b217f55993955da9ad0cae7735747b2f24390 Mon Sep 17 00:00:00 2001 From: baude Date: Thu, 8 Mar 2018 15:45:52 -0600 Subject: Stage3 Image Library This represents the stage3 implementation for the image library. At this point, we are moving the image-centric functions to pkg/image including migration of args and object-oriented references. This is a not a one-for-one migration of funcs and some funcs will need to continue to reside in runtime_img as they are overly specific to libpod and probably not useful to others. Signed-off-by: baude Closes: #484 Approved by: baude --- cmd/podman/create.go | 5 +++-- cmd/podman/exec.go | 3 ++- cmd/podman/inspect.go | 3 ++- cmd/podman/ps.go | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) (limited to 'cmd/podman') diff --git a/cmd/podman/create.go b/cmd/podman/create.go index 46429b335..b923ad458 100644 --- a/cmd/podman/create.go +++ b/cmd/podman/create.go @@ -18,6 +18,7 @@ import ( "github.com/pkg/errors" "github.com/projectatomic/libpod/libpod" "github.com/projectatomic/libpod/pkg/inspect" + "github.com/projectatomic/libpod/pkg/util" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) @@ -299,7 +300,7 @@ func isPortInPortBindings(pb map[nat.Port][]nat.PortBinding, port nat.Port) bool for _, i := range pb { hostPorts = append(hostPorts, i[0].HostPort) } - return libpod.StringInSlice(port.Port(), hostPorts) + return util.StringInSlice(port.Port(), hostPorts) } // isPortInImagePorts determines if an exposed host port was given to us by metadata @@ -625,7 +626,7 @@ func parseCreateOpts(c *cli.Context, runtime *libpod.Runtime, imageName string, } // Check for . and dns-search domains - if libpod.StringInSlice(".", c.StringSlice("dns-search")) && len(c.StringSlice("dns-search")) > 1 { + if util.StringInSlice(".", c.StringSlice("dns-search")) && len(c.StringSlice("dns-search")) > 1 { return nil, errors.Errorf("cannot pass additional search domains when also specifying '.'") } diff --git a/cmd/podman/exec.go b/cmd/podman/exec.go index 07ef3a0cd..81b69953b 100644 --- a/cmd/podman/exec.go +++ b/cmd/podman/exec.go @@ -6,6 +6,7 @@ import ( "github.com/pkg/errors" "github.com/projectatomic/libpod/libpod" + "github.com/projectatomic/libpod/pkg/util" "github.com/urfave/cli" ) @@ -89,7 +90,7 @@ func execCmd(c *cli.Context) error { // key and value to the environment variables. this is needed to set // PATH for example. for k, v := range defaultEnvVariables { - if !libpod.StringInSlice(k, userEnvKeys) { + if !util.StringInSlice(k, userEnvKeys) { envs = append(envs, fmt.Sprintf("%s=%s", k, v)) } } diff --git a/cmd/podman/inspect.go b/cmd/podman/inspect.go index 8bf6f96be..cfd257af4 100644 --- a/cmd/podman/inspect.go +++ b/cmd/podman/inspect.go @@ -9,6 +9,7 @@ import ( "github.com/projectatomic/libpod/cmd/podman/formats" "github.com/projectatomic/libpod/libpod" "github.com/projectatomic/libpod/pkg/inspect" + "github.com/projectatomic/libpod/pkg/util" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) @@ -68,7 +69,7 @@ func inspectCmd(c *cli.Context) error { } defer runtime.Shutdown(false) - if !libpod.StringInSlice(inspectType, []string{inspectTypeContainer, inspectTypeImage, inspectAll}) { + if !util.StringInSlice(inspectType, []string{inspectTypeContainer, inspectTypeImage, inspectAll}) { return errors.Errorf("the only recognized types are %q, %q, and %q", inspectTypeContainer, inspectTypeImage, inspectAll) } diff --git a/cmd/podman/ps.go b/cmd/podman/ps.go index 4dd7133bc..ca4c4ca82 100644 --- a/cmd/podman/ps.go +++ b/cmd/podman/ps.go @@ -17,6 +17,7 @@ import ( "github.com/pkg/errors" "github.com/projectatomic/libpod/cmd/podman/formats" "github.com/projectatomic/libpod/libpod" + "github.com/projectatomic/libpod/pkg/util" "github.com/sirupsen/logrus" "github.com/urfave/cli" "k8s.io/apimachinery/pkg/fields" @@ -275,7 +276,7 @@ func generateContainerFilterFuncs(filter, filterValue string, runtime *libpod.Ru return false }, nil case "status": - if !libpod.StringInSlice(filterValue, []string{"created", "restarting", "running", "paused", "exited", "unknown"}) { + if !util.StringInSlice(filterValue, []string{"created", "restarting", "running", "paused", "exited", "unknown"}) { return nil, errors.Errorf("%s is not a valid status", filterValue) } return func(c *libpod.Container) bool { -- cgit v1.2.3-54-g00ecf