Fix bug around pushing manifest lists that refer to the same manifest twice as children

This commit is contained in:
Joseph Schorr 2018-11-19 18:26:22 +02:00
parent 45db1d27e7
commit 54904cfd6e
3 changed files with 115 additions and 3 deletions

View file

@ -59,7 +59,7 @@ def _create_manifest(repository_id, manifest_interface_instance, storage):
# Load, parse and get/create the child manifests, if any.
retriever = RepositoryContentRetriever.for_repository(repository_id, storage)
child_manifest_refs = manifest_interface_instance.child_manifests(retriever)
child_manifest_rows = []
child_manifest_rows = {}
child_manifest_label_dicts = []
if child_manifest_refs is not None:
@ -90,7 +90,7 @@ def _create_manifest(repository_id, manifest_interface_instance, storage):
logger.error('Could not get/create child manifest')
return None
child_manifest_rows.append(child_manifest_info.manifest)
child_manifest_rows[child_manifest_info.manifest.digest] = child_manifest_info.manifest
child_manifest_label_dicts.append(labels)
# Ensure all the blobs in the manifest exist.
@ -147,7 +147,7 @@ def _create_manifest(repository_id, manifest_interface_instance, storage):
if child_manifest_rows:
children_to_insert = [dict(manifest=manifest, child_manifest=child_manifest,
repository=repository_id)
for child_manifest in child_manifest_rows]
for child_manifest in child_manifest_rows.values()]
ManifestChild.insert_many(children_to_insert).execute()
# Define the labels for the manifest (if any).