From 2b724509b9709b41dc5c3a049e4e231df8a8de30 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 25 Aug 2015 15:34:49 -0400 Subject: [PATCH] Fix 500 error when pushing a manifest previously pushed Fixes #400 --- data/model/tag.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/data/model/tag.py b/data/model/tag.py index b020f019a..b314be476 100644 --- a/data/model/tag.py +++ b/data/model/tag.py @@ -164,8 +164,15 @@ def revert_tag(repo_obj, tag_name, docker_image_id): def store_tag_manifest(namespace, repo_name, tag_name, docker_image_id, manifest_digest, manifest_data): - tag = create_or_update_tag(namespace, repo_name, tag_name, docker_image_id) - return TagManifest.create(tag=tag, digest=manifest_digest, json_data=manifest_data) + with db_transaction(): + tag = create_or_update_tag(namespace, repo_name, tag_name, docker_image_id) + + try: + manifest = TagManifest.get(digest=manifest_digest) + manifest.tag = tag + manifest.save() + except TagManifest.DoesNotExist: + return TagManifest.create(tag=tag, digest=manifest_digest, json_data=manifest_data) def _get_active_tag(namespace, repo_name, tag_name):