Skip to content

Commit

Permalink
container: Factor out loading an image tarball
Browse files Browse the repository at this point in the history
  • Loading branch information
apyrgio committed Dec 2, 2024
1 parent c133a5a commit bb4c47b
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions dangerzone/isolation_provider/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,16 +223,14 @@ def add_image_tag(cur_tag: str, new_tag: str) -> None:
)

@staticmethod
def install() -> bool:
"""
Make sure the podman container is installed. Linux only.
"""
if Container.is_container_installed():
return True
def get_expected_tag() -> str:
"""Get the tag of the Dangerzone image tarball from the image-id.txt file."""
with open(get_resource_path("image-id.txt")) as f:
return f.read.strip()

# Load the container into podman
@staticmethod
def load_image_tarball() -> None:
log.info("Installing Dangerzone container image...")

p = subprocess.Popen(
[Container.get_runtime(), "load"],
stdin=subprocess.PIPE,
Expand All @@ -259,6 +257,18 @@ def install() -> bool:
f"Could not install container image: {error}"
)

log.info("Successfully installed container image from")

@staticmethod
def install() -> bool:
"""
Make sure the podman container is installed. Linux only.
"""
if Container.is_container_installed():
return True

Container.load_image_tarball()

if not Container.is_container_installed(raise_on_error=True):
return False

Expand Down

0 comments on commit bb4c47b

Please sign in to comment.