Adjust usage of image model in manifest model
This commit is contained in:
parent
584a18c0e1
commit
23ff49f0c1
3 changed files with 15 additions and 8 deletions
|
@ -7,7 +7,7 @@ from endpoints.api import (resource, nickname, require_repo_read, RepositoryPara
|
|||
from endpoints.exception import NotFound
|
||||
|
||||
|
||||
def _image_dict(image, with_history=False, with_tags=False):
|
||||
def image_dict(image, with_history=False, with_tags=False):
|
||||
image_data = {
|
||||
'id': image.docker_image_id,
|
||||
'created': format_date(image.created),
|
||||
|
@ -22,7 +22,7 @@ def _image_dict(image, with_history=False, with_tags=False):
|
|||
image_data['tags'] = [tag.name for tag in image.tags]
|
||||
|
||||
if with_history:
|
||||
image_data['history'] = [_image_dict(parent, with_history, with_tags)
|
||||
image_data['history'] = [image_dict(parent, with_history, with_tags)
|
||||
for parent in image.parents]
|
||||
|
||||
# Calculate the ancestors string, with the DBID's replaced with the docker IDs.
|
||||
|
@ -46,7 +46,7 @@ class RepositoryImageList(RepositoryParamResource):
|
|||
raise NotFound()
|
||||
|
||||
images = registry_model.get_legacy_images(repo_ref)
|
||||
return {'images': [_image_dict(image, with_tags=True) for image in images]}
|
||||
return {'images': [image_dict(image, with_tags=True) for image in images]}
|
||||
|
||||
|
||||
@resource('/v1/repository/<apirepopath:repository>/image/<image_id>')
|
||||
|
@ -68,4 +68,4 @@ class RepositoryImage(RepositoryParamResource):
|
|||
if image is None:
|
||||
raise NotFound()
|
||||
|
||||
return _image_dict(image, with_history=True)
|
||||
return image_dict(image, with_history=True)
|
||||
|
|
Reference in a new issue