Fix an NPE when trying to pull a manifest without a legacy image via V1
This commit is contained in:
parent
d9da838df1
commit
b1dd053b02
6 changed files with 68 additions and 4 deletions
|
@ -15,6 +15,7 @@ class V1ProtocolSteps(Enum):
|
|||
PUT_TAG = 'put-tag'
|
||||
PUT_IMAGE_JSON = 'put-image-json'
|
||||
DELETE_TAG = 'delete-tag'
|
||||
GET_TAG = 'get-tag'
|
||||
GET_LAYER = 'get-layer'
|
||||
|
||||
|
||||
|
@ -49,6 +50,9 @@ class V1Protocol(RegistryProtocol):
|
|||
V1ProtocolSteps.GET_LAYER: {
|
||||
Failures.GEO_BLOCKED: 403,
|
||||
},
|
||||
V1ProtocolSteps.GET_TAG: {
|
||||
Failures.UNKNOWN_TAG: 404,
|
||||
},
|
||||
}
|
||||
|
||||
def __init__(self, jwk):
|
||||
|
@ -99,11 +103,18 @@ class V1Protocol(RegistryProtocol):
|
|||
image_ids = self.conduct(session, 'GET', prefix + 'tags', headers=headers).json()
|
||||
|
||||
for tag_name in tag_names:
|
||||
# GET /v1/repositories/{namespace}/{repository}/tags/<tag_name>
|
||||
image_id_data = self.conduct(session, 'GET', prefix + 'tags/' + tag_name,
|
||||
headers=headers,
|
||||
expected_status=(200, expected_failure,
|
||||
V1ProtocolSteps.GET_TAG))
|
||||
|
||||
if tag_name not in image_ids:
|
||||
assert expected_failure == Failures.UNKNOWN_TAG
|
||||
return None
|
||||
|
||||
tag_image_id = image_ids[tag_name]
|
||||
assert image_id_data.json() == tag_image_id
|
||||
|
||||
# Retrieve the ancestry of the tagged image.
|
||||
image_prefix = '/v1/images/%s/' % tag_image_id
|
||||
|
|
Reference in a new issue