From 1c6919dd9377e0f6b00c97eab58bcba25e6fad0e Mon Sep 17 00:00:00 2001 From: Jake Moshenko Date: Tue, 10 Nov 2015 13:33:03 -0500 Subject: [PATCH] We must fill in the parent_id on linking --- data/model/image.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/data/model/image.py b/data/model/image.py index 9001dd13a..c607e8823 100644 --- a/data/model/image.py +++ b/data/model/image.py @@ -196,14 +196,21 @@ def _find_or_link_image(existing_image, repo_obj, username, translations, prefer copied_storage.locations = {placement.location.name for placement in copied_storage.imagestorageplacement_set} + translated_parent_id = None + if new_image_ancestry != '/': + translated_parent_id = int(new_image_ancestry.split('/')[-2]) + new_image = Image.create(docker_image_id=existing_image.docker_image_id, - repository=repo_obj, storage=copied_storage, + repository=repo_obj, + storage=copied_storage, ancestors=new_image_ancestry, command=existing_image.command, created=existing_image.created, comment=existing_image.comment, v1_json_metadata=existing_image.v1_json_metadata, - aggregate_size=existing_image.aggregate_size) + aggregate_size=existing_image.aggregate_size, + parent_id=translated_parent_id, + v1_checksum=existing_image.v1_checksum) logger.debug('Storing translation %s -> %s', existing_image.id, new_image.id)