diff --git a/data/model/image.py b/data/model/image.py index 2fc8f837d..031f4a660 100644 --- a/data/model/image.py +++ b/data/model/image.py @@ -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):