Switch content retrieval in manifests to be behind an interface

This allows for easy separation of retrieval of config blobs vs manifests
This commit is contained in:
Joseph Schorr 2018-11-19 11:55:52 +02:00
parent 1eaf5b18dd
commit cbfb6054e5
7 changed files with 143 additions and 124 deletions

View file

@ -314,10 +314,10 @@ class DockerSchema1Manifest(ManifestInterface):
def local_blob_digests(self):
return self.blob_digests
def child_manifests(self, lookup_manifest_fn):
def child_manifests(self, content_retriever):
return None
def get_manifest_labels(self, lookup_config_fn):
def get_manifest_labels(self, content_retriever):
return self.layers[-1].v1_metadata.labels
def unsigned(self):
@ -374,10 +374,10 @@ class DockerSchema1Manifest(ManifestInterface):
signed_content_tail = base64url_decode(str(parsed_protected[DOCKER_SCHEMA1_FORMAT_TAIL_KEY]))
return signed_content_head + signed_content_tail
def generate_legacy_layers(self, images_map, lookup_config_fn):
def generate_legacy_layers(self, images_map, content_retriever):
return self.rewrite_invalid_image_ids(images_map)
def get_v1_compatible_manifest(self, namespace_name, repo_name, tag_name, lookup_fn):
def get_v1_compatible_manifest(self, namespace_name, repo_name, tag_name, content_retriever):
""" Returns the manifest that is compatible with V1, by virtue of being `amd64` and `linux`.
If none, returns None.
"""