Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Transport Prefixes #133

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

wahabk
Copy link

@wahabk wahabk commented Dec 17, 2024

There isn't a CONTRIB.md so I have created a fork and PR.

Closes #132. TLDR: enables podman-hpc pull docker://docker.io/library/ubuntu:latest.

I thought that simply adding this after the podman pull subprocess would do the job instead of updating MigrateUtils().

def pull(ctx, siteconf, image, podman_args, **site_opts):
    """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
  • Do you reckon this is a good place for the check? Or should it be after if proc.returncode == 0:?
  • Can you think of another Podman-HPC wrapped function that would be affected by transport prefixes?
  • I don't currently have a dev environment for podman-hpc. If you would accept this change / or have feedback do let me know and I'll do some testing.

@wahabk wahabk changed the title Wahabk/issue132 transport prefix Enable Transport Prefixes Dec 17, 2024
@wahabk
Copy link
Author

wahabk commented Jan 3, 2025

I note that the format is oci-archive:path:tag and not the separator ://. More examples available here https://docs.podman.io/en/latest/markdown/podman-pull.1.html#source

Copy link
Member

@scanon scanon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my suggestions

@@ -206,13 +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."""
"""Pulls an image to a local repository and makes a squashed copy."""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you fix the trailing whitespaces?


# Check for transport_prefix
if "://" in image:
transport_prefix, image = image.split("://", 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the prefix isn't used, maybe replace this with just

if "://" in image:
        image = image.split("://", 1)[0]

# Check for transport_prefix
if "://" in image:
transport_prefix, image = image.split("://", 1)
else:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can drop the else section since we don't use the transport prefix

@scanon
Copy link
Member

scanon commented Jan 3, 2025

Thanks for the report and proposed fix. This looks good and this seems a reasonable place to handle it. Can you do a few minor things just to keep the flake8 happy.

I'll add a few other minor comments and then we can merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

podman-hpc does not accept transport prefixes docker://
2 participants