Skip to content

Commit

Permalink
adding small doc changes
Browse files Browse the repository at this point in the history
Signed-off-by: tarilabs <[email protected]>
  • Loading branch information
tarilabs committed Dec 24, 2024
1 parent 9505ce5 commit 93574af
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions olot/oci/oci_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
)]

class MediaTypes:
"""Constant values from OCI Image Manifest spec
See also: https://github.com/opencontainers/image-spec/blob/main/media-types.md
"""
manifest: MediaType = "application/vnd.oci.image.manifest.v1+json"
index: MediaType = "application/vnd.oci.image.index.v1+json"
layer: MediaType = "application/vnd.oci.image.layer.v1.tar"
Expand Down
2 changes: 1 addition & 1 deletion olot/oci/oci_image_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,4 @@ def read_ocilayout_root_index(ocilayout: Path) -> OCIImageIndex:
ocilayout_root_index = None
with open(ocilayout / "index.json", "r") as f:
ocilayout_root_index = OCIImageIndex.model_validate_json(f.read())
return ocilayout_root_index
return ocilayout_root_index
2 changes: 1 addition & 1 deletion olot/oci/oci_image_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ def verify_ocilayout(ocilayout: Path):
if not m.imageLayoutVersion == ImageLayoutVersion.field_1_0_0:
raise ValueError(f"Unexpected ocilayout in {ocilayout}")
else:
return True
return True
6 changes: 4 additions & 2 deletions olot/utils/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@ def tar_filter_fn(input: tarfile.TarInfo) -> tarfile.TarInfo :
"""
A filter function for modifying file metadata when adding files to a tar archive.
See also: https://docs.openshift.com/container-platform/4.17/openshift_images/create-images.html#use-uid_create-images
Args:
input (tarfile.TarInfo): The file metadata object representing a file being added to the tar archive.
Returns:
tarfile.TarInfo: The modified file metadata with the following changes:
- `uid` set to 0 (root user).
- `gid` set to 0 (root group).
- `mode` set to 0o664 (read/write for owner and group, read-only for others).
- `mode` set to 0o664 (read/write for root owner and root group, read-only for others).
"""
input.uid = 0
input.gid = 0
Expand Down Expand Up @@ -123,4 +125,4 @@ def targz_from_file(file_path: Path, dest: Path) -> tuple[str, str]:
except tarfile.TarError as e:
raise tarfile.TarError(f"Error creating tarball: {e}") from e
except OSError as e:
raise OSError(f"File operation failed: {e}") from e
raise OSError(f"File operation failed: {e}") from e
2 changes: 1 addition & 1 deletion olot/utils/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
def compute_hash_of_str(content: str) -> str:
h = hashlib.sha256()
h.update(content.encode())
return h.hexdigest()
return h.hexdigest()

0 comments on commit 93574af

Please sign in to comment.