Skip to content

Commit

Permalink
Fix a pull-through cache error with old manifests
Browse files Browse the repository at this point in the history
fixes: #1700
  • Loading branch information
git-hyagi authored and lubosmj committed Aug 2, 2024
1 parent e2a1003 commit 1075b43
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGES/1700.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Resolved an issue with the pull-through cache that was causing errors when retrieving v2 schema 1
manifests.
9 changes: 4 additions & 5 deletions pulp_container/app/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,7 @@ async def init_pending_content(self, digest, manifest_data, media_type, raw_text
manifest = Manifest(
digest=digest,
schema_version=(
2
if manifest_data["mediaType"] in (MEDIA_TYPE.MANIFEST_V2, MEDIA_TYPE.MANIFEST_OCI)
else 1
2 if media_type in (MEDIA_TYPE.MANIFEST_V2, MEDIA_TYPE.MANIFEST_OCI) else 1
),
media_type=media_type,
config_blob=config_blob,
Expand All @@ -468,8 +466,9 @@ async def init_pending_content(self, digest, manifest_data, media_type, raw_text
await sync_to_async(manifest.touch)()
await sync_to_async(self.repository.pending_manifests.add)(manifest)

for layer in manifest_data["layers"]:
blob = await self.save_blob(layer["digest"], manifest)
for layer in manifest_data.get("layers") or manifest_data.get("fsLayers"):
layer_digest = layer.get("digest") or layer.get("blobSum")
blob = await self.save_blob(layer_digest, manifest)
await sync_to_async(self.repository.pending_blobs.add)(blob)

async def save_blob(self, digest, manifest):
Expand Down

0 comments on commit 1075b43

Please sign in to comment.