Skip to content

Commit

Permalink
Fixed null value in column "manifest_id" during sync.
Browse files Browse the repository at this point in the history
closes #537

(cherry picked from commit 4f85e83)
  • Loading branch information
ipanova committed Feb 11, 2022
1 parent 18e53b3 commit 774c2e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES/537.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed "manifest_id" violates not-null constraint error during sync.
8 changes: 3 additions & 5 deletions pulp_container/app/tasks/sync_stages.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ async def run(self):
"""
ContainerFirstStage.
"""
future_manifests = []
tag_list = []
tag_dcs = []
to_download = []
Expand Down Expand Up @@ -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:
Expand All @@ -139,17 +137,17 @@ 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()
for digest, man_dc in man_dcs.items():
man = await man_dc.resolution()
artifact = await sync_to_async(man._artifacts.get)()
with artifact.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:
Expand Down

0 comments on commit 774c2e9

Please sign in to comment.