Fix the translation of old ids to new ids, again.
This commit is contained in:
parent
61ca29de04
commit
4b689a7a7c
4 changed files with 21 additions and 11 deletions
|
@ -193,17 +193,15 @@ def create_repository(namespace, repository):
|
|||
for desc in image_descriptions])
|
||||
new_repo_images = dict(added_images)
|
||||
|
||||
existing_image_translations = {}
|
||||
for existing in model.get_repository_images(namespace, repository):
|
||||
if existing.docker_image_id in new_repo_images:
|
||||
existing_image_translations[existing.docker_image_id] = existing.id
|
||||
added_images.pop(existing.docker_image_id)
|
||||
|
||||
username = get_authenticated_user() and get_authenticated_user().username
|
||||
translations = {}
|
||||
for image_description in added_images.values():
|
||||
model.create_or_link_image(image_description['id'], repo, username,
|
||||
translations, existing_image_translations)
|
||||
model.find_create_or_link_image(image_description['id'], repo, username,
|
||||
translations)
|
||||
|
||||
response = make_response('Created', 201)
|
||||
|
||||
|
|
Reference in a new issue