Skip to content

Commit 8635175

Browse files
committed
Be less strict with OCI image index manifest annotations
This commit allows `annotations.cname` to be missing in OCI image index manifest entries. It uses the `digest` in this case for `manifests_as_dict()`. Signed-off-by: Tobias Wolf <[email protected]>
1 parent fdfc773 commit 8635175

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/gardenlinux/oci/index.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ def manifests_as_dict(self):
5555
manifests = {}
5656

5757
for manifest in self["manifests"]:
58-
if "cname" not in manifest.get("annotations", {}):
59-
raise RuntimeError(
60-
"Unexpected manifest with missing annotation 'cname' found"
61-
)
58+
if "annotations" not in manifest or "cname" not in manifest["annotations"]:
59+
manifest_key = manifest["digest"]
60+
else:
61+
manifest_key = manifest["annotations"]["cname"]
6262

63-
manifests[manifest["annotations"]["cname"]] = manifest
63+
manifests[manifest_key] = manifest
6464

6565
return manifests
6666

0 commit comments

Comments
 (0)