Merge pull request #1818 from coreos-inc/handle-key-error

Handle KeyError nicer in _get_parent_image
This commit is contained in:
josephschorr 2016-09-09 13:42:52 -04:00 committed by GitHub
commit b979f99964

View file

@ -71,7 +71,10 @@ def _get_parent_images(namespace_name, repository_name, image_obj, include_place
filter_to_parents)
id_to_image = {unicode(image.id): image for image in parents}
return [id_to_image[parent_id] for parent_id in reversed(parent_db_ids)]
try:
return [id_to_image[parent_id] for parent_id in reversed(parent_db_ids)]
except KeyError:
raise DataModelException('Unknown parent image')
def get_repo_image(namespace_name, repository_name, docker_image_id):