Code review fixes

This commit is contained in:
Joseph Schorr 2018-11-14 09:15:58 +02:00
parent 3b4002877a
commit d97055e2ba
6 changed files with 30 additions and 15 deletions

View file

@ -30,12 +30,14 @@ class ManifestInterface(object):
@abstractproperty
def layers(self):
""" Returns the layers of this manifest, from base to leaf or None if none. """
""" Returns the layers of this manifest, from base to leaf or None if this kind of manifest
does not support layers. """
pass
@abstractproperty
def leaf_layer_v1_image_id(self):
""" Returns the Docker V1 image ID for the leaf (top) layer, if any, or None if none. """
""" Returns the Docker V1 image ID for the leaf (top) layer, if any, or None if
not applicable. """
pass
@abstractproperty
@ -53,14 +55,15 @@ class ManifestInterface(object):
@abstractmethod
def child_manifests(self, lookup_manifest_fn):
""" Returns an iterator of all manifests that live under this manifest, if any or None if none.
The lookup_manifest_fn is a function that, when given a blob content SHA, returns the
contents of that blob in storage if any or None if none.
""" Returns an iterator of all manifests that live under this manifest, if any or None if not
applicable. The lookup_manifest_fn is a function that, when given a blob content SHA,
returns the contents of that blob in storage if any or None if none.
"""
@abstractmethod
def get_manifest_labels(self, lookup_config_fn):
""" Returns a dictionary of all the labels defined inside this manifest or None if none. """
""" Returns a dictionary of all the labels defined inside this manifest or None if this kind
of manifest does not support labels. """
pass
@abstractmethod

View file

@ -317,7 +317,7 @@ class DockerSchema1Manifest(ManifestInterface):
self._architecture)
for layer in reversed(self.layers):
builder.add_layer(str(layer.digest), layer.raw_v1_metadata)
return builder.build()
def _generate_layers(self):

View file

@ -73,8 +73,6 @@ def test_valid_manifest():
assert manifest.leaf_layer.compressed_size == 73109
blob_digests = list(manifest.blob_digests)
assert len(blob_digests) == len(manifest.layers) + 1
expected = [str(layer.digest) for layer in manifest.layers] + [manifest.config.digest]
assert blob_digests == expected