diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-01-13 09:34:33 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-13 09:34:33 -0800 |
commit | 140ae25c4d0c7ba89a0bb7ae16f81f90d20be535 (patch) | |
tree | a5e30854d0669694556fdde8de43e00d30176d9c /cmd | |
parent | 9ada9722ecba373b317e1ab3e9adf716fc777d8d (diff) | |
parent | 43c6da22b976b6050f86dca50564a4c2b08caee0 (diff) | |
download | podman-140ae25c4d0c7ba89a0bb7ae16f81f90d20be535.tar.gz podman-140ae25c4d0c7ba89a0bb7ae16f81f90d20be535.tar.bz2 podman-140ae25c4d0c7ba89a0bb7ae16f81f90d20be535.zip |
Merge pull request #2141 from baude/remotetag
Add darwin support for remote-client
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/exists.go | 11 | ||||
-rw-r--r-- | cmd/podman/main.go | 11 | ||||
-rw-r--r-- | cmd/podman/platform_linux.go | 17 | ||||
-rw-r--r-- | cmd/podman/platform_unsupported.go | 6 | ||||
-rw-r--r-- | cmd/podman/tag.go | 8 |
5 files changed, 39 insertions, 14 deletions
diff --git a/cmd/podman/exists.go b/cmd/podman/exists.go index 2e2559ec7..bd1bc24ec 100644 --- a/cmd/podman/exists.go +++ b/cmd/podman/exists.go @@ -5,6 +5,7 @@ import ( "github.com/containers/libpod/cmd/podman/libpodruntime" "github.com/containers/libpod/libpod" + "github.com/containers/libpod/libpod/adapter" "github.com/containers/libpod/libpod/image" "github.com/pkg/errors" "github.com/urfave/cli" @@ -66,13 +67,15 @@ func imageExistsCmd(c *cli.Context) error { if len(args) > 1 || len(args) < 1 { return errors.New("you may only check for the existence of one image at a time") } - runtime, err := libpodruntime.GetRuntime(c) + localRuntime, err := adapter.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not get runtime") } - defer runtime.Shutdown(false) - if _, err := runtime.ImageRuntime().NewFromLocal(args[0]); err != nil { - if errors.Cause(err) == image.ErrNoSuchImage { + defer localRuntime.Runtime.Shutdown(false) + if _, err := localRuntime.NewImageFromLocal(args[0]); err != nil { + //TODO we need to ask about having varlink defined errors exposed + //so we can reuse them + if errors.Cause(err) == image.ErrNoSuchImage || err.Error() == "io.podman.ImageNotFound" { os.Exit(1) } return err diff --git a/cmd/podman/main.go b/cmd/podman/main.go index 604404827..ce60bbfb7 100644 --- a/cmd/podman/main.go +++ b/cmd/podman/main.go @@ -120,7 +120,7 @@ func main() { os.Exit(1) } args := c.Args() - if args.Present() { + if args.Present() && rootless.IsRootless() { if _, notRequireRootless := cmdsNotRequiringRootless[args.First()]; !notRequireRootless { became, ret, err := rootless.BecomeRootInUserNS() if err != nil { @@ -265,11 +265,10 @@ func main() { Usage: "output logging information to syslog as well as the console", }, } - if _, err := os.Stat("/etc/containers/registries.conf"); err != nil { - if os.IsNotExist(err) { - logrus.Warn("unable to find /etc/containers/registries.conf. some podman (image shortnames) commands may be limited") - } - } + // Check if /etc/containers/registries.conf exists when running in + // in a local environment. + CheckForRegistries() + if err := app.Run(os.Args); err != nil { if debug { logrus.Errorf(err.Error()) diff --git a/cmd/podman/platform_linux.go b/cmd/podman/platform_linux.go new file mode 100644 index 000000000..2127923ae --- /dev/null +++ b/cmd/podman/platform_linux.go @@ -0,0 +1,17 @@ +// +build linux + +package main + +import ( + "os" + + "github.com/sirupsen/logrus" +) + +func CheckForRegistries() { + if _, err := os.Stat("/etc/containers/registries.conf"); err != nil { + if os.IsNotExist(err) { + logrus.Warn("unable to find /etc/containers/registries.conf. some podman (image shortnames) commands may be limited") + } + } +} diff --git a/cmd/podman/platform_unsupported.go b/cmd/podman/platform_unsupported.go new file mode 100644 index 000000000..f39eeaf63 --- /dev/null +++ b/cmd/podman/platform_unsupported.go @@ -0,0 +1,6 @@ +// +build !linux + +package main + +func CheckForRegistries() { +} diff --git a/cmd/podman/tag.go b/cmd/podman/tag.go index 29f66d41e..c99e5d173 100644 --- a/cmd/podman/tag.go +++ b/cmd/podman/tag.go @@ -1,7 +1,7 @@ package main import ( - "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod/adapter" "github.com/pkg/errors" "github.com/urfave/cli" ) @@ -23,13 +23,13 @@ func tagCmd(c *cli.Context) error { if len(args) < 2 { return errors.Errorf("image name and at least one new name must be specified") } - runtime, err := libpodruntime.GetRuntime(c) + localRuntime, err := adapter.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not create runtime") } - defer runtime.Shutdown(false) + defer localRuntime.Runtime.Shutdown(false) - newImage, err := runtime.ImageRuntime().NewFromLocal(args[0]) + newImage, err := localRuntime.NewImageFromLocal(args[0]) if err != nil { return err } |