Revert "Merge pull request #682 from jzelinskie/revertrevert"
This reverts commit627ad25c9c
, reversing changes made to31c392fecc
.
This commit is contained in:
parent
24b7064140
commit
278bc736e3
10 changed files with 65 additions and 212 deletions
|
@ -211,10 +211,11 @@ def put_image_layer(namespace, repository, image_id):
|
|||
try:
|
||||
logger.debug('Retrieving image data')
|
||||
uuid = repo_image.storage.uuid
|
||||
json_data = repo_image.v1_json_metadata
|
||||
except (AttributeError):
|
||||
json_data = store.get_content(repo_image.storage.locations, store.image_json_path(uuid))
|
||||
except (IOError, AttributeError):
|
||||
logger.exception('Exception when retrieving image data')
|
||||
abort(404, 'Image %(image_id)s not found', issue='unknown-image', image_id=image_id)
|
||||
abort(404, 'Image %(image_id)s not found', issue='unknown-image',
|
||||
image_id=image_id)
|
||||
|
||||
logger.debug('Retrieving image path info')
|
||||
layer_path = store.image_layer_path(uuid)
|
||||
|
@ -331,7 +332,8 @@ def put_image_checksum(namespace, repository, image_id):
|
|||
abort(404, 'Image not found: %(image_id)s', issue='unknown-image', image_id=image_id)
|
||||
|
||||
logger.debug('Looking up repo layer data')
|
||||
if not repo_image.v1_json_metadata:
|
||||
uuid = repo_image.storage.uuid
|
||||
if not store.exists(repo_image.storage.locations, store.image_json_path(uuid)):
|
||||
abort(404, 'Image not found: %(image_id)s', issue='unknown-image', image_id=image_id)
|
||||
|
||||
logger.debug('Marking image path')
|
||||
|
@ -371,7 +373,12 @@ def get_image_json(namespace, repository, image_id, headers):
|
|||
|
||||
logger.debug('Looking up repo image')
|
||||
repo_image = model.image.get_repo_image_extended(namespace, repository, image_id)
|
||||
if repo_image is None:
|
||||
|
||||
logger.debug('Looking up repo layer data')
|
||||
try:
|
||||
uuid = repo_image.storage.uuid
|
||||
data = store.get_content(repo_image.storage.locations, store.image_json_path(uuid))
|
||||
except (IOError, AttributeError):
|
||||
flask_abort(404)
|
||||
|
||||
logger.debug('Looking up repo layer size')
|
||||
|
@ -381,7 +388,7 @@ def get_image_json(namespace, repository, image_id, headers):
|
|||
# so handle this case rather than failing.
|
||||
headers['X-Docker-Size'] = str(size)
|
||||
|
||||
response = make_response(repo_image.v1_json_metadata, 200)
|
||||
response = make_response(data, 200)
|
||||
response.headers.extend(headers)
|
||||
return response
|
||||
|
||||
|
@ -484,6 +491,8 @@ def put_image_json(namespace, repository, image_id):
|
|||
model.tag.create_temporary_hidden_tag(repo, repo_image,
|
||||
app.config['PUSH_TEMP_TAG_EXPIRATION_SEC'])
|
||||
|
||||
uuid = repo_image.storage.uuid
|
||||
|
||||
if image_id != data['id']:
|
||||
abort(400, 'JSON data contains invalid id for image: %(image_id)s',
|
||||
issue='invalid-request', image_id=image_id)
|
||||
|
@ -501,12 +510,17 @@ def put_image_json(namespace, repository, image_id):
|
|||
if parent_id:
|
||||
logger.debug('Looking up parent image data')
|
||||
|
||||
if parent_id and not parent_image.v1_json_metadata:
|
||||
if (parent_id and not
|
||||
store.exists(parent_locations, store.image_json_path(parent_uuid))):
|
||||
abort(400, 'Image %(image_id)s depends on non existing parent image %(parent_id)s',
|
||||
issue='invalid-request', image_id=image_id, parent_id=parent_id)
|
||||
|
||||
logger.debug('Looking up image storage paths')
|
||||
json_path = store.image_json_path(uuid)
|
||||
|
||||
logger.debug('Checking if image already exists')
|
||||
if repo_image.v1_json_metadata and not image_is_uploading(repo_image):
|
||||
if (store.exists(repo_image.storage.locations, json_path) and not
|
||||
image_is_uploading(repo_image)):
|
||||
exact_abort(409, 'Image already exists')
|
||||
|
||||
set_uploading_flag(repo_image, True)
|
||||
|
@ -522,8 +536,6 @@ def put_image_json(namespace, repository, image_id):
|
|||
data.get('comment'), command, v1_metadata, parent_image)
|
||||
|
||||
logger.debug('Putting json path')
|
||||
uuid = repo_image.storage.uuid
|
||||
json_path = store.image_json_path(uuid)
|
||||
store.put_content(repo_image.storage.locations, json_path, request.data)
|
||||
|
||||
logger.debug('Generating image ancestry')
|
||||
|
|
Reference in a new issue