Fix image API for V2 images
This commit is contained in:
parent
bc4e07343e
commit
dead054b43
2 changed files with 13 additions and 16 deletions
|
@ -12,11 +12,10 @@ from util.cache import cache_control_flask_restful
|
|||
|
||||
|
||||
def image_view(image, image_map, include_ancestors=True):
|
||||
extended_props = image
|
||||
# TODO: Remove once we've migrated all storage data to the image records.
|
||||
storage_props = image
|
||||
if image.storage and image.storage.id:
|
||||
extended_props = image.storage
|
||||
|
||||
command = extended_props.command
|
||||
storage_props = image.storage
|
||||
|
||||
def docker_id(aid):
|
||||
if not aid or not aid in image_map:
|
||||
|
@ -24,12 +23,13 @@ def image_view(image, image_map, include_ancestors=True):
|
|||
|
||||
return image_map[aid].docker_image_id
|
||||
|
||||
command = image.command or storage_props.command
|
||||
image_data = {
|
||||
'id': image.docker_image_id,
|
||||
'created': format_date(extended_props.created),
|
||||
'comment': extended_props.comment,
|
||||
'created': format_date(image.created or storage_props.created),
|
||||
'comment': image.comment or storage_props.comment,
|
||||
'command': json.loads(command) if command else None,
|
||||
'size': extended_props.image_size,
|
||||
'size': storage_props.image_size,
|
||||
'uploading': image.storage.uploading,
|
||||
'sort_index': len(image.ancestors),
|
||||
}
|
||||
|
|
Reference in a new issue