Adjustments based on code review feedback
This commit is contained in:
parent
c46b11bac1
commit
1eaf5b18dd
9 changed files with 30 additions and 19 deletions
|
@ -4,9 +4,13 @@ from six import add_metaclass
|
|||
@add_metaclass(ABCMeta)
|
||||
class ManifestInterface(object):
|
||||
""" Defines the interface for the various manifests types supported. """
|
||||
@abstractproperty
|
||||
def is_manifest_list(self):
|
||||
""" Returns whether this manifest is a list. """
|
||||
|
||||
@abstractproperty
|
||||
def schema_version(self):
|
||||
""" The version of the schema, or None for lists. """
|
||||
""" The version of the schema. """
|
||||
|
||||
@abstractproperty
|
||||
def digest(self):
|
||||
|
|
|
@ -206,6 +206,10 @@ class DockerSchema1Manifest(ManifestInterface):
|
|||
if not verified:
|
||||
raise InvalidSchema1Signature()
|
||||
|
||||
@property
|
||||
def is_manifest_list(self):
|
||||
return False
|
||||
|
||||
@property
|
||||
def schema_version(self):
|
||||
return 1
|
||||
|
|
|
@ -183,10 +183,14 @@ class DockerSchema2ManifestList(ManifestInterface):
|
|||
except ValidationError as ve:
|
||||
raise MalformedSchema2ManifestList('manifest data does not match schema: %s' % ve)
|
||||
|
||||
@property
|
||||
def is_manifest_list(self):
|
||||
""" Returns whether this manifest is a list. """
|
||||
return True
|
||||
|
||||
@property
|
||||
def schema_version(self):
|
||||
""" The version of the schema, or None for lists. """
|
||||
return None
|
||||
return 2
|
||||
|
||||
@property
|
||||
def digest(self):
|
||||
|
|
|
@ -140,6 +140,10 @@ class DockerSchema2Manifest(ManifestInterface):
|
|||
if layer.is_remote and not layer.urls:
|
||||
raise MalformedSchema2Manifest('missing `urls` for remote layer')
|
||||
|
||||
@property
|
||||
def is_manifest_list(self):
|
||||
return False
|
||||
|
||||
@property
|
||||
def schema_version(self):
|
||||
return 2
|
||||
|
|
|
@ -75,8 +75,6 @@ def test_valid_manifestlist():
|
|||
|
||||
manifestlist = DockerSchema2ManifestList(MANIFESTLIST_BYTES)
|
||||
assert len(manifestlist.manifests(_get_manifest)) == 2
|
||||
assert (manifestlist.digest ==
|
||||
'sha256:340d7dadea77035533a2d43e8ff711ecca1965978a6e7699b87e32b35f76038d')
|
||||
|
||||
assert manifestlist.media_type == 'application/vnd.docker.distribution.manifest.list.v2+json'
|
||||
assert manifestlist.bytes == MANIFESTLIST_BYTES
|
||||
|
@ -108,8 +106,6 @@ def test_get_v1_compatible_manifest_no_matching_list():
|
|||
|
||||
manifestlist = DockerSchema2ManifestList(NO_AMD_MANIFESTLIST_BYTES)
|
||||
assert len(manifestlist.manifests(_get_manifest)) == 1
|
||||
assert (manifestlist.digest ==
|
||||
'sha256:40ed1cfe692333bfa519a9bfed9676975a990fff5afd35efa628320c39c793ca')
|
||||
|
||||
assert manifestlist.media_type == 'application/vnd.docker.distribution.manifest.list.v2+json'
|
||||
assert manifestlist.bytes == NO_AMD_MANIFESTLIST_BYTES
|
||||
|
|
Reference in a new issue