diff --git a/CHANGES/537.bugfix b/CHANGES/537.bugfix new file mode 100644 index 000000000..b2afdbfcb --- /dev/null +++ b/CHANGES/537.bugfix @@ -0,0 +1 @@ +Fixed "manifest_id" violates not-null constraint error during sync. diff --git a/pulp_container/app/tasks/sync_stages.py b/pulp_container/app/tasks/sync_stages.py index 01d442ba4..8ad3fb9c7 100644 --- a/pulp_container/app/tasks/sync_stages.py +++ b/pulp_container/app/tasks/sync_stages.py @@ -68,7 +68,6 @@ async def run(self): """ ContainerFirstStage. """ - future_manifests = [] tag_list = [] tag_dcs = [] to_download = [] @@ -130,7 +129,6 @@ async def run(self): tag_dc.extra_data["tagged_manifest_dc"] = list_dc for manifest_data in content_data.get("manifests"): man_dc = self.create_manifest(list_dc, manifest_data) - future_manifests.append(man_dc) man_dcs[man_dc.content.digest] = man_dc await self.put(man_dc) else: @@ -139,17 +137,16 @@ async def run(self): ) await self.put(man_dc) tag_dc.extra_data["tagged_manifest_dc"] = man_dc + await man_dc.resolution() await self.handle_blobs(man_dc, content_data) tag_dcs.append(tag_dc) await pb_parsed_tags.aincrement() - for manifest_future in future_manifests: - man = await manifest_future.resolution() - artifact = await sync_to_async(man._artifacts.get)() - with artifact.file.open() as content_file: + for digest, man_dc in man_dcs.items(): + man = await man_dc.resolution() + with sync_to_async(man._artifacts.get)().file.open() as content_file: raw = content_file.read() content_data = json.loads(raw) - man_dc = man_dcs[man.digest] await self.handle_blobs(man_dc, content_data) for tag_dc in tag_dcs: