From 6f3d2edc2beb8d18452cdd7b3b1ef7f05b90f5c5 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 12 Apr 2019 14:19:11 +0200 Subject: pull: remove cryptic error message we were printing something like: (0x1840f00,0xc00041bba0) Closes: https://github.com/containers/libpod/issues/2710 Signed-off-by: Giuseppe Scrivano --- cmd/podman/pull.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/podman/pull.go b/cmd/podman/pull.go index 491d3a8c2..aa000fc52 100644 --- a/cmd/podman/pull.go +++ b/cmd/podman/pull.go @@ -61,7 +61,7 @@ func init() { // pullCmd gets the data from the command line and calls pullImage // to copy an image from a registry to a local machine -func pullCmd(c *cliconfig.PullValues) error { +func pullCmd(c *cliconfig.PullValues) (retError error) { if c.Bool("trace") { span, _ := opentracing.StartSpanFromContext(Ctx, "pullCmd") defer span.Finish() @@ -163,7 +163,7 @@ func pullCmd(c *cliconfig.PullValues) error { for _, name := range names { newImage, err := runtime.New(getContext(), name, c.String("signature-policy"), authfile, writer, &dockerRegistryOptions, image.SigningOptions{}, true, nil) if err != nil { - println(errors.Wrapf(err, "error pulling image %q", name)) + logrus.Errorf("error pulling image %q", name) foundImage = false continue } -- cgit v1.2.3-54-g00ecf From fcea6fda82cc3809f8990c0c80a52f6c4a03c5cd Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 12 Apr 2019 14:26:39 +0200 Subject: pull: exit with error if the image is not found Closes: https://github.com/containers/libpod/issues/2785 Signed-off-by: Giuseppe Scrivano --- cmd/podman/pull.go | 5 +++++ test/e2e/pull_test.go | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/cmd/podman/pull.go b/cmd/podman/pull.go index aa000fc52..7cc7b65b3 100644 --- a/cmd/podman/pull.go +++ b/cmd/podman/pull.go @@ -62,6 +62,11 @@ func init() { // pullCmd gets the data from the command line and calls pullImage // to copy an image from a registry to a local machine func pullCmd(c *cliconfig.PullValues) (retError error) { + defer func() { + if retError != nil && exitCode == 0 { + exitCode = 1 + } + }() if c.Bool("trace") { span, _ := opentracing.StartSpanFromContext(Ctx, "pullCmd") defer span.Finish() diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go index de6d4ea09..4e4e80d56 100644 --- a/test/e2e/pull_test.go +++ b/test/e2e/pull_test.go @@ -38,6 +38,12 @@ var _ = Describe("Podman pull", func() { }) + It("podman pull from docker a not existing image", func() { + session := podmanTest.Podman([]string{"pull", "ibetthisdoesntexistthere:foo"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Not(Equal(0))) + }) + It("podman pull from docker with tag", func() { session := podmanTest.Podman([]string{"pull", "busybox:glibc"}) session.WaitWithDefaultTimeout() -- cgit v1.2.3-54-g00ecf