Fix an NPE when trying to pull a manifest without a legacy image via V1

This commit is contained in:
Joseph Schorr 2019-01-10 13:36:05 -05:00
parent d9da838df1
commit b1dd053b02
6 changed files with 68 additions and 4 deletions

View file

@ -33,6 +33,16 @@ class PreOCIModel(SharedModel, RegistryDataInterface):
manifests. """
return False
def get_tag_legacy_image_id(self, repository_ref, tag_name, storage):
""" Returns the legacy image ID for the tag with a legacy images in
the repository. Returns None if None.
"""
tag = self.get_repo_tag(repository_ref, tag_name, include_legacy_image=True)
if tag is None:
return None
return tag.legacy_image.docker_image_id
def get_legacy_tags_map(self, repository_ref, storage):
""" Returns a map from tag name to its legacy image, for all tags with legacy images in
the repository.