forked from osbuild/osbuild
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
osbuild-mpp: extract is_manifest_list() function
Extract the is_manifest_list() function from the ImageManifest object in osbuild-mpp into a util function to be reused by the skopeo source.
- Loading branch information
1 parent
d20b833
commit 56ac5b8
Showing
2 changed files
with
16 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
def is_manifest_list(data): | ||
"""Inspect a manifest determine if it's a multi-image manifest-list.""" | ||
media_type = data.get("mediaType") | ||
# Check if mediaType is set according to docker or oci specifications | ||
if media_type in ("application/vnd.docker.distribution.manifest.list.v2+json", | ||
"application/vnd.oci.image.index.v1+json"): | ||
return True | ||
|
||
# According to the OCI spec, setting mediaType is not mandatory. So, if it is not set at all, check for the | ||
# existence of manifests | ||
if media_type is None and data.get("manifests") is not None: | ||
return True | ||
|
||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters