Fix for mapping translations for existing images.
This commit is contained in:
parent
f8eb0c983f
commit
f339160ab9
2 changed files with 18 additions and 5 deletions
|
@ -187,15 +187,18 @@ def create_repository(namespace, repository):
|
|||
added_images = OrderedDict([(desc['id'], desc)
|
||||
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)
|
||||
translations, existing_image_translations)
|
||||
|
||||
response = make_response('Created', 201)
|
||||
|
||||
|
|
Reference in a new issue