Get V1 registry code working with new model methods

This commit is contained in:
Joseph Schorr 2016-07-12 16:09:13 -04:00 committed by Jimmy Zelinskie
parent 94d71f2166
commit ea18790dfe
3 changed files with 124 additions and 61 deletions

View file

@ -30,11 +30,10 @@ logger = logging.getLogger(__name__)
def _finish_image(namespace, repository, image_id):
# Checksum is ok, we remove the marker
v1.update_image_uploading(namespace, repository, image_id, False)
blob_ref = v1.update_image_uploading(namespace, repository, image_id, False)
# Send a job to the work queue to replicate the image layer.
# TODO(jzelinskie): make this not use imagestorage
queue_storage_replication(namespace, repo_image.storage)
queue_storage_replication(namespace, blob_ref)
def require_completion(f):
@ -292,7 +291,7 @@ def put_image_checksum(namespace, repository, image_id):
if len(checksum_parts) != 2:
abort(400, 'Invalid checksum format')
v1.store_docker_v1_checksum(namespace, repository, image_id, checksum, content_checksum)
v1.store_docker_v1_checksums(namespace, repository, image_id, checksum, content_checksum)
if checksum not in session.get('checksum', []):
logger.debug('session checksums: %s', session.get('checksum', []))
@ -400,12 +399,13 @@ def put_image_json(namespace, repository, image_id):
username = get_granted_username()
logger.debug('Image not found, creating or linking image with initiating user context: %s', username)
v1.create_or_link_image(username, repository, image_id, store.preferred_locations[0])
v1.create_or_link_image(username, namespace, repository, image_id, store.preferred_locations[0])
v1_metadata = v1.docker_v1_metadata(namespace, repository, image_id)
# Create a temporary tag to prevent this image from getting garbage collected while the push
# is in progress.
v1.create_temp_hidden_tag(namespace, repository, app.config['PUSH_TEMP_TAG_EXPIRATION_SEC'])
v1.create_temp_hidden_tag(namespace, repository, image_id,
app.config['PUSH_TEMP_TAG_EXPIRATION_SEC'])
parent_id = data.get('parent', None)
if parent_id: