Add image ancestry and update the test db accordingly.
This commit is contained in:
parent
abdf731f7a
commit
ea6df2b725
5 changed files with 43 additions and 14 deletions
|
@ -188,10 +188,15 @@ def role_view(repo_perm_obj):
|
|||
def list_tag_images(namespace, repository, tag):
|
||||
permission = ReadRepositoryPermission(namespace, repository)
|
||||
if permission.can() or model.repository_is_public(namespace, repository):
|
||||
images = model.get_tag_images(namespace, repository, tag)
|
||||
tag_image = model.get_tag_image(namespace, repository, tag)
|
||||
parent_images = model.get_parent_images(tag_image)
|
||||
|
||||
parents = list(parent_images)
|
||||
parents.reverse()
|
||||
all_images = [tag_image] + parents
|
||||
|
||||
return jsonify({
|
||||
'images': [image_view(image) for image in images]
|
||||
'images': [image_view(image) for image in all_images]
|
||||
})
|
||||
|
||||
abort(403) # Permission denied
|
||||
|
|
|
@ -290,8 +290,14 @@ def put_image_json(namespace, repository, image_id):
|
|||
# If we reach that point, it means that this is a new image or a retry
|
||||
# on a failed push
|
||||
# save the metadata
|
||||
if parent_id:
|
||||
parent_obj = model.get_image_by_id(parent_id)
|
||||
else:
|
||||
parent_obj = None
|
||||
|
||||
model.set_image_metadata(image_id, namespace, repository,
|
||||
data.get('created'), data.get('comment'))
|
||||
data.get('created'), data.get('comment'),
|
||||
parent_obj)
|
||||
store.put_content(mark_path, 'true')
|
||||
store.put_content(json_path, request.data)
|
||||
generate_ancestry(namespace, repository, image_id, parent_id)
|
||||
|
|
Reference in a new issue