Handle KeyError nicer in _get_parent_image

Fixes #1810
This commit is contained in:
Joseph Schorr 2016-09-09 13:34:56 -04:00
parent 96d358f526
commit 3d542b5e93

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):