From c0ff351a2ed5708b6dd548a8c551f594ec0ee9e7 Mon Sep 17 00:00:00 2001 From: Alex Pyrgiotis Date: Mon, 10 Mar 2025 14:45:03 +0200 Subject: [PATCH] FIXUP: Use 'load -i' --- dangerzone/container_utils.py | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/dangerzone/container_utils.py b/dangerzone/container_utils.py index ee528d0..d651f0a 100644 --- a/dangerzone/container_utils.py +++ b/dangerzone/container_utils.py @@ -128,23 +128,21 @@ def get_expected_tag() -> str: def load_image_tarball() -> None: log.info("Installing Dangerzone container image...") tarball_path = get_resource_path("container.tar") - with open(tarball_path) as f: - try: - res = subprocess.run( - [get_runtime(), "load"], - stdin=f, - startupinfo=get_subprocess_startupinfo(), - capture_output=True, - check=True, - ) - except subprocess.CalledProcessError as e: - if e.stderr: - error = e.stderr.decode() - else: - error = "No output" - raise errors.ImageInstallationException( - f"Could not install container image: {error}" - ) + try: + res = subprocess.run( + [get_runtime(), "load", "-i", tarball_path], + startupinfo=get_subprocess_startupinfo(), + capture_output=True, + check=True, + ) + except subprocess.CalledProcessError as e: + if e.stderr: + error = e.stderr.decode() + else: + error = "No output" + raise errors.ImageInstallationException( + f"Could not install container image: {error}" + ) # Loading an image built with Buildkit in Podman 3.4 messes up its name. The tag # somehow becomes the name of the loaded image [1].