Skip to content

Commit b0ce404

Browse files
committed
Add simple data repair during manifest sync
1 parent 28ebe19 commit b0ce404

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

pulp_container/app/tasks/sync_stages.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ async def _check_for_existing_manifest(self, download_tag):
101101
content_data, raw_text_data, response = await self._download_manifest_data(
102102
response.url
103103
)
104+
if manifest.data is None:
105+
manifest.data = raw_text_data
106+
await manifest.asave(update_fields=["data"])
104107
# END OF BACKWARD COMPATIBILITY
105108

106109
else:
@@ -533,12 +536,16 @@ async def create_listed_manifest(self, manifest_data):
533536
content_data = json.loads(manifest.data)
534537
# TODO: BACKWARD COMPATIBILITY - remove after fully migrating to artifactless manifest
535538
elif saved_artifact := await manifest._artifacts.afirst():
536-
content_data, _ = await sync_to_async(get_content_data)(saved_artifact)
539+
content_data, raw_bytes_data = await sync_to_async(get_content_data)(saved_artifact)
540+
manifest.data = raw_bytes_data.decode("utf-8")
541+
await manifest.asave(update_fields=["data"])
537542
# if artifact is not available (due to reclaim space) we will download it again
538543
else:
539-
content_data, manifest = await self._download_and_instantiate_manifest(
544+
content_data, new_manifest = await self._download_and_instantiate_manifest(
540545
manifest_url, digest
541546
)
547+
manifest.data = new_manifest.data
548+
await manifest.asave(update_fields=["data"])
542549
# END OF BACKWARD COMPATIBILITY
543550
else:
544551
content_data, manifest = await self._download_and_instantiate_manifest(

0 commit comments

Comments
 (0)