From 4e5d671349f1d1f8ea50a5712d3f8528f475a6cb Mon Sep 17 00:00:00 2001 From: Jake Moshenko Date: Thu, 19 Feb 2015 16:46:01 -0500 Subject: [PATCH] Fix a bug in the concurrent push code which prevented failed pushes from being resumed. --- endpoints/registry.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/endpoints/registry.py b/endpoints/registry.py index c901eed5b..07a33c4d9 100644 --- a/endpoints/registry.py +++ b/endpoints/registry.py @@ -455,14 +455,15 @@ def put_image_json(namespace, repository, image_id): issue='invalid-request', image_id=image_id) logger.debug('Looking up repo image') + + repo = model.get_repository(namespace, repository) + if repo is None: + abort(404, 'Repository does not exist: %(namespace)s/%(repository)s', issue='no-repo', + namespace=namespace, repository=repository) + repo_image = model.get_repo_image_extended(namespace, repository, image_id) if not repo_image: logger.debug('Image not found, creating image') - repo = model.get_repository(namespace, repository) - if repo is None: - abort(404, 'Repository does not exist: %(namespace)s/%(repository)s', issue='no-repo', - namespace=namespace, repository=repository) - username = get_authenticated_user() and get_authenticated_user().username repo_image = model.find_create_or_link_image(image_id, repo, username, {}, store.preferred_locations[0])