singularityhub / sregistry-cli

Singularity Global Client for container management
https://singularityhub.github.io/sregistry-cli/
Mozilla Public License 2.0
14 stars 18 forks source link

Invalid URL error with GitLab #255

Closed haristotle closed 4 years ago

haristotle commented 4 years ago

Hi,

I'm new to this, so if I should put this somewhere else, please let me know.

Error Anyways, I am getting the following error when trying to pull a container:

Invalid URL 'None/singularityhub/gitlab-ci/-/jobs/122059246/artifacts/raw/build/Singularity.simg/?inline=false': No schema supplied. Perhaps you meant http://None/singularityhub/gitlab-ci/-/jobs/122059246/artifacts/raw/build/Singularity.simg/?inline=false?'

To Reproduce Steps to reproduce the behavior:

  1. Install sregistry with pip
  2. Try to pull a container from the example gitlab project: sregistry pull 122059246,singularityhub/gitlab-ci

Expected behavior I expected sregistry to pull the container down as in the example here: https://singularityhub.github.io/sregistry-cli/client-gitlab

Workaround I found that if I reordered this block from sregistry/main/gitlab/_init_.py:

class Client(ApiConnection):
    def __init__(self, secrets=None, base=None, **kwargs):

        self._reset_headers()
        self._update_secrets()
        self._update_base()
        super(Client, self).__init__(**kwargs)

to be this:

class Client(ApiConnection):
    def __init__(self, secrets=None, base=None, **kwargs):

        super(Client, self).__init__(**kwargs)
        self._reset_headers()
        self._update_secrets()
        self._update_base()

Then everything works as expected.

I'm not sure if this is the best solution or if there's a good reason to put super() in any particular place. Also, I don't know why super() is erasing the data in self.base, so I feel like this may be a symptom of a bigger issue.

Version of Singularity and Singularity Registry Client My Singularity version is 3.5.2+380-gc2452e48d My Singularity Registry Client version is 0.2.34

Let me know if you need anything else.

Thanks!

vsoch commented 4 years ago

Yes, the order of super is very important! If you've fixed the issue, would you care to open a PR with the change? Also be sure to add a note to the changelog and bump the version in sregistry/version.py. There were a bunch of changes to the super class since this module was developed, so I'm not surprised that you hit the issue.

haristotle commented 4 years ago

Yes, I have opened a PR. Let me know if I did anything wrong or need to do anything else.

vsoch commented 4 years ago

Fixed with https://github.com/singularityhub/sregistry-cli/pull/256