From 3d542b5e93456675d9e0decadd370418ea7e4672 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 9 Sep 2016 13:34:56 -0400 Subject: [PATCH] Handle KeyError nicer in _get_parent_image Fixes #1810 --- data/model/image.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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):