Skip to content

Commit

Permalink
Except 'NotFound' error if FROM image DNE
Browse files Browse the repository at this point in the history
Currently when running Tern with a Dockerfile, if the FROM 'image:tag'
does not exist, there is a long Traceback output. This commit adds the
'docker.errors.NotFound: 404 Client Error' error as an exception in the
pull_image() function in tern/analyze/docker/container.py so that Tern
fails more gracefully while still reporting the error.

Resolves #610

Signed-off-by: Rose Judge <rjudge@vmware.com>
  • Loading branch information
rnjudge authored and Nisha K committed Mar 27, 2020
1 parent 765b699 commit b626d60
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tern/analyze/docker/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def pull_image(image_tag_string):
image = client.images.pull(image_tag_string)
logger.debug("Image \"%s\" downloaded", image_tag_string)
return image
except docker.errors.ImageNotFound:
except (docker.errors.ImageNotFound, docker.errors.NotFound):
logger.warning("No such image: \"%s\"", image_tag_string)
return None

Expand Down

0 comments on commit b626d60

Please sign in to comment.