From f13f3d11dc624b9950ad6da2e44f8dfedd7709ea Mon Sep 17 00:00:00 2001 From: wahabk Date: Tue, 17 Dec 2024 16:18:28 +0000 Subject: [PATCH 1/2] remove transport prefix in `pull` --- podman_hpc/podman_hpc.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/podman_hpc/podman_hpc.py b/podman_hpc/podman_hpc.py index 38b7ae3..7ad00b6 100755 --- a/podman_hpc/podman_hpc.py +++ b/podman_hpc/podman_hpc.py @@ -207,6 +207,12 @@ def images(ctx, siteconf, image, podman_args, **site_opts): @click.argument("image") def pull(ctx, siteconf, image, podman_args, **site_opts): """Pulls an image to a local repository and makes a squashed copy.""" + # Check for transport_prefix + if "://" in image: + transport_prefix, image = image.split("://", 1) + else: + transport_prefix = None + cmd = [siteconf.podman_bin, "pull"] cmd.extend(podman_args) cmd.extend(siteconf.get_cmd_extensions("pull", site_opts)) From 1e3978ec91a7b77e1d71ee83e9f6253ecce830b9 Mon Sep 17 00:00:00 2001 From: wahabk Date: Tue, 17 Dec 2024 16:26:02 +0000 Subject: [PATCH 2/2] remove prefix after subprocess --- podman_hpc/podman_hpc.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/podman_hpc/podman_hpc.py b/podman_hpc/podman_hpc.py index 7ad00b6..3d8e3b7 100755 --- a/podman_hpc/podman_hpc.py +++ b/podman_hpc/podman_hpc.py @@ -206,19 +206,20 @@ def images(ctx, siteconf, image, podman_args, **site_opts): @click.argument("podman_args", nargs=-1, type=click.UNPROCESSED) @click.argument("image") def pull(ctx, siteconf, image, podman_args, **site_opts): - """Pulls an image to a local repository and makes a squashed copy.""" - # Check for transport_prefix - if "://" in image: - transport_prefix, image = image.split("://", 1) - else: - transport_prefix = None - + """Pulls an image to a local repository and makes a squashed copy.""" cmd = [siteconf.podman_bin, "pull"] cmd.extend(podman_args) cmd.extend(siteconf.get_cmd_extensions("pull", site_opts)) cmd.append(image) proc = Popen(cmd) proc.communicate() + + # Check for transport_prefix + if "://" in image: + transport_prefix, image = image.split("://", 1) + else: + transport_prefix = None + if proc.returncode == 0: sys.stdout.write(f"INFO: Migrating image to {siteconf.squash_dir}\n") mu = MigrateUtils(conf=siteconf)