Skip to content

Commit

Permalink
pull: exit with error if the image is not found
Browse files Browse the repository at this point in the history
Closes: containers#2785

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Apr 12, 2019
1 parent 6f3d2ed commit fcea6fd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/podman/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 6 additions & 0 deletions test/e2e/pull_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit fcea6fd

Please sign in to comment.