Unify the get_layers calls across all implements of manifest schemas to ensure we have a common type returned
Also renames some methods to make it more clear what kind of information they return
This commit is contained in:
parent
180d8847db
commit
4e1ff90cb2
17 changed files with 210 additions and 124 deletions
|
@ -543,20 +543,21 @@ class V2Protocol(RegistryProtocol):
|
|||
if manifest.schema_version == 1:
|
||||
image_ids[tag_name] = manifest.leaf_layer_v1_image_id
|
||||
|
||||
# Verify the layers.
|
||||
# Verify the blobs.
|
||||
layer_index = 0
|
||||
empty_count = 0
|
||||
blob_digests = list(manifest.blob_digests)
|
||||
for image in images:
|
||||
if manifest.schema_version == 2 and image.is_empty:
|
||||
empty_count += 1
|
||||
continue
|
||||
|
||||
# If the layer is remote, then we expect the blob to *not* exist in the system.
|
||||
layer = manifest.layers[layer_index]
|
||||
blob_digest = blob_digests[layer_index]
|
||||
expected_status = 404 if image.urls else 200
|
||||
result = self.conduct(session, 'GET',
|
||||
'/v2/%s/blobs/%s' % (self.repo_name(namespace, repo_name),
|
||||
layer.digest),
|
||||
blob_digest),
|
||||
expected_status=expected_status,
|
||||
headers=headers)
|
||||
|
||||
|
@ -565,7 +566,7 @@ class V2Protocol(RegistryProtocol):
|
|||
|
||||
layer_index += 1
|
||||
|
||||
assert (len(manifest.layers) + empty_count) == len(images)
|
||||
assert (len(blob_digests) + empty_count) >= len(images) # Schema 2 has 1 extra for config
|
||||
|
||||
return PullResult(manifests=manifests, image_ids=image_ids)
|
||||
|
||||
|
|
Reference in a new issue