diff --git a/endpoints/registry.py b/endpoints/registry.py index 47d4f65ac..72633939e 100644 --- a/endpoints/registry.py +++ b/endpoints/registry.py @@ -370,6 +370,7 @@ def generate_ancestry(image_id, uuid, locations, parent_id=None, parent_uuid=Non if not parent_id: store.put_content(locations, store.image_ancestry_path(uuid), json.dumps([image_id])) return + data = store.get_content(parent_locations, store.image_ancestry_path(parent_uuid)) data = json.loads(data) data.insert(0, image_id) @@ -470,8 +471,13 @@ def put_image_json(namespace, repository, image_id): store.put_content(repo_image.storage.locations, json_path, request.data) profile.debug('Generating image ancestry') - generate_ancestry(image_id, uuid, repo_image.storage.locations, parent_id, parent_uuid, - parent_locations) + + try: + generate_ancestry(image_id, uuid, repo_image.storage.locations, parent_id, parent_uuid, + parent_locations) + except IOError as ioe: + profile.debug('Error when generating ancestry: %s' % ioe.message) + abort(404) profile.debug('Done') return make_response('true', 200)