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

Use init hook instead of prereposetup #6

Conversation

dave-pollock
Copy link
Contributor

I ran into this issue: #3

When debugging, I could see that Yum was hitting the error inside the _baseurlSetup method: http://yum.baseurl.org/download/docs/yum-api/3.2.27/yum.yumRepo-pysrc.html#YumRepository._baseurlSetup

It seemed as if the YumRepository class was not being overridden by the GCSRepository class, so the normal validation was being applied to the GCS repo.

I added conduit.info(2, 'prereposetup_hook') at the beginning of the prereposetup_hook method and as far as I could see it was never being called. It's as if the validation occurs in Yum before the prereposetup hook is run.

Using the init_hook instead caused the code to run and everything started working. No more validation error.

I don't really understand how this plugin ever worked given the behavior I'm seeing - No idea if this is specific to the version of Yum I'm using or what - and I have no idea if there will be unintended side effects of using the init hook instead, but this seems to be working for me..

I could be completely off track here so @fabianmenges please let me know if I'm doing something stupid.

Yum version: 3.4.3
CentOS 7

@fabianmenges
Copy link
Contributor

This is working for us, I assume they changed the internal interface or behavior of YUM. This is targeting Cent 7.x what distro are you running?

@dave-pollock
Copy link
Contributor Author

Hi @fabianmenges,

I'm using CentOS 7 - see below for details.

cat /etc/centos-release
CentOS Linux release 7.7.1908 (Core)
yum --version
3.4.3
  Installed: rpm-4.11.3-40.el7.x86_64 at 2019-09-19 02:33
  Built    : CentOS BuildSystem <http://bugs.centos.org> at 2019-08-06 22:50
  Committed: Pavlina Moravcova Varekova <[email protected]> at 2019-05-26

  Installed: yum-3.4.3-163.el7.centos.noarch at 2019-09-19 02:36
  Built    : CentOS BuildSystem <http://bugs.centos.org> at 2019-08-08 11:57
  Committed: CentOS Sources <[email protected]> at 2019-08-06

  Installed: yum-plugin-fastestmirror-1.1.31-52.el7.noarch at 2019-09-19 02:36
  Built    : CentOS BuildSystem <http://bugs.centos.org> at 2019-08-09 03:26
  Committed: Michal Domonkos <[email protected]> at 2019-04-26
With `def prereposetup_hook(conduit):`
# 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
With `def init_hook(conduit):`
# yum update

Loaded plugins: fastestmirror, gsiam
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                                                                                                                                                                                                               |  18 kB  00:00:00     
 * base: mirrors.tripadvisor.com
 * epel: epel.mirror.constant.com
 * extras: mirror.cogentco.com
 * updates: mirror.cc.columbia.edu
base                                                                                                                                                                                                                                                               | 3.6 kB  00:00:00     
extras                                                                                                                                                                                                                                                             | 2.9 kB  00:00:00     
google-cloud-compute/signature                                                                                                                                                                                                                                     |  454 B  00:00:00     
google-cloud-compute/signature                                                                                                                                                                                                                                     | 1.4 kB  00:00:00 !!! 
google-cloud-sdk/signature                                                                                                                                                                                                                                         |  454 B  00:00:00     
google-cloud-sdk/signature                                                                                                                                                                                                                                         | 1.4 kB  00:00:00 !!! 
updates                                                                                                                                                                                                                                                            | 2.9 kB  00:00:00     
downloading gs://my-bucket/my-repo/repodata/repomd.xml to /var/cache/yum/x86_64/7/my-repo/repomd6bIoNItmp.xml
No packages marked for update

Hope that helps. Let me know if any other info would be useful.

@dave-pollock dave-pollock deleted the use-init-hook-instead-of-prereposetup branch November 1, 2022 23:51
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.

2 participants