Merge pull request #2911 from giuseppe/fix-pull-errors

pull: fix a couple of issues
This commit is contained in:
OpenShift Merge Robot
2019-04-12 12:40:51 -07:00
committed by GitHub
2 changed files with 13 additions and 2 deletions

View File

@ -61,7 +61,12 @@ 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) {
defer func() {
if retError != nil && exitCode == 0 {
exitCode = 1
}
}()
if c.Bool("trace") {
span, _ := opentracing.StartSpanFromContext(Ctx, "pullCmd")
defer span.Finish()
@ -163,7 +168,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
}

View File

@ -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()