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

Doesn't seem to work at all #3

Closed
Miscreancy opened this issue Feb 28, 2020 · 5 comments
Closed

Doesn't seem to work at all #3

Miscreancy opened this issue Feb 28, 2020 · 5 comments

Comments

@Miscreancy
Copy link

Attempted to use this today as we'd like to use GCS as the backend for a yum repo for internal releases.

Installed all dependencies, set the repo file up, and came back with error:
Cannot find a valid baseurl for repo: [reponame]

Further up we could see:

Loading mirror speeds from cached hostfile
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. gs://[bucketname]/[filepath]

Confirmed the creds are there for bucket access and we can see the plugin is loading, it just doesn't appear to actually do anything for yum.

Further specs:
Linux: Centos 7.7.1908 (Core)
Yum version: yum-3.4.3-163
RPM version: rpm-4.11.3-40
yum-plugin-gs-iam version: 1.0.0
google-auth version: 1.9
google-cloud version: 0.34.0
google-cloud-storage version: 1.26.0

Happy to provide more information if required.

@dave-pollock
Copy link
Contributor

@Miscreancy I ran into the same problem and have submitted a pull request which worked for me. You might like to try https://github.com/dave-pollock/yum-gs-iam until the maintainer accepts/rejects my PR.

@Miscreancy
Copy link
Author

Thanks @dave-pollock , appreciate the response. I'll take a look 👍

@Miscreancy
Copy link
Author

Update on this - attempted to work with @dave-pollock's fork but sadly also wasn't successful. Same machine as previously, error 'Plugin "gsiam" can't be imported'.

Happy to work with anyone to resolve this, otherwise I'll start hacking through the code myself and seeing what I can make of it.

@dave-pollock
Copy link
Contributor

@Miscreancy if the plugin is not being loaded it sounds more like this issue: #2

My fork worked for me when my output looked like this:

# yum update

Loaded plugins: fastestmirror, gsiam
Loading mirror speeds from cached hostfile
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. gs://my-bucket/my-repo/


 One of the configured repositories failed (Unknown),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=<repoid> ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>
        or
            subscription-manager repos --disable=<repoid>

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: my-repo

@shatil
Copy link
Contributor

shatil commented Apr 15, 2021

@fabianmenges, or anyone else with a Docker container (or CentOS install they're willing to risk), can test like this, from the root of the Git repo:

docker run --rm -it \
        -v $(pwd)/example.repo:/etc/yum.repos.d/example.repo \
        -v $(pwd)/gsiam.conf:/etc/yum/pluginconf.d/gsiam.conf \
        -v $(pwd)/gsiam.py:/usr/lib/yum-plugins/gsiam.py \
        yum-gs-iam \
        yum repolist

(My container image yum-gs-iam has the necessary SDK components installed. Without these, gsiam will fail to load like in #2.)

On a9fb5cb right now:

Loaded plugins: fastestmirror, gsiam, ovl
Determining fastest mirrors
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. gs://example-bucket/path-to-repo/

Using my pull request's commit shatil@0442f65, you'll instead see that the GCS plugin works and parses the gs:// URL fine, and get an expected traceback for Google Cloud credentials error instead, like:

Loaded plugins: fastestmirror, gsiam, ovl                                                    
Determining fastest mirrors
 * base: linux.mirrors.es.net                                                                
 * extras: mirror.sfo12.us.leaseweb.net                                                      
 * updates: centos-distro.cavecreek.net 

...

Traceback (most recent call last):                                                           
  File "/usr/bin/yum", line 29, in <module>
    yummain.user_main(sys.argv[1:], exit_code=True)                             
  File "/usr/share/yum-cli/yummain.py", line 375, in user_main
    errcode = main(args)

...

google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or
explicitly create credential and re-run the application. For more
information, please see

fabianmenges added a commit that referenced this issue Apr 15, 2021
Fix #3 w/ CentOS 7.7+ compatibility for gsiam.py
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

No branches or pull requests

3 participants