New tests and small fixes while comparing against the V2 spec
Fixes #391
This commit is contained in:
parent
41bfe2ffde
commit
decdaa4c79
6 changed files with 232 additions and 33 deletions
|
@ -15,7 +15,7 @@ from app import storage, docker_v2_signing_key
|
|||
from auth.jwt_auth import process_jwt_auth
|
||||
from endpoints.decorators import anon_protect
|
||||
from endpoints.v2 import v2_bp, require_repo_read, require_repo_write
|
||||
from endpoints.v2.errors import (ManifestBlobUnknown, ManifestInvalid, ManifestUnverified,
|
||||
from endpoints.v2.errors import (BlobUnknown, ManifestInvalid, ManifestUnverified,
|
||||
ManifestUnknown, TagInvalid, NameInvalid)
|
||||
from endpoints.trackhelper import track_and_log
|
||||
from endpoints.notificationhelper import spawn_notification
|
||||
|
@ -102,7 +102,12 @@ class SignedManifest(object):
|
|||
"""
|
||||
for blob_sum_obj, history_obj in reversed(zip(self._parsed[_FS_LAYERS_KEY],
|
||||
self._parsed[_HISTORY_KEY])):
|
||||
image_digest = digest_tools.Digest.parse_digest(blob_sum_obj[_BLOB_SUM_KEY])
|
||||
|
||||
try:
|
||||
image_digest = digest_tools.Digest.parse_digest(blob_sum_obj[_BLOB_SUM_KEY])
|
||||
except digest_tools.InvalidDigestException:
|
||||
raise ManifestInvalid()
|
||||
|
||||
metadata_string = history_obj[_V1_COMPAT_KEY]
|
||||
|
||||
v1_metadata = json.loads(metadata_string)
|
||||
|
@ -271,7 +276,7 @@ def _write_manifest(namespace, repo_name, manifest):
|
|||
leaf_layer = mdata
|
||||
|
||||
except model.InvalidImageException:
|
||||
raise ManifestBlobUnknown(detail={'missing': digest_str})
|
||||
raise BlobUnknown(detail={'digest': digest_str})
|
||||
|
||||
if leaf_layer is None:
|
||||
# The manifest doesn't actually reference any layers!
|
||||
|
|
Reference in a new issue