Bug #35404
closedRunning "satellite-maintain self-upgrade" on a Satellite\Capsule 6.11.1.1 fails with error "Error: 'satellite-maintenance-6.11.2-for-rhel-8-x86_64-rpms' does not match a valid repository ID"
Description
Description of problem:
The goal of using "satellite-maintain self-upgrade" is usually for performing a major version upgrade i.e. 6.10 to 6.11 , but when we execute this command on Satellite\Capsule 6.11.1.1 , It tries to enable the maintenance-rpms repo with a wrong version.
Version-Release number of selected component (if applicable):
Satellite\Capsule 6.11.1.1
How reproducible:
100%
Steps to Reproduce:
1. Install the latest most version of Satellite 6.11 and ensure we are on 6.11.1.1-1
2. Run "satellite-maintain self-upgrade"
Actual results:
On RHEL 7:
~~~
Failed executing yum --enablerepo=rhel-7-server-rpms --enablerepo=rhel-server-rhscl-7-rpms --enablerepo=rhel-7-server-satellite-maintenance-6.11.2-rpms y --disableplugin=foreman-protector update satellite-maintain rubygem-foreman_maintain, exit status 1:
Loaded plugins: enabled_repos_upload, package_upload, product-id, search
: disabled-repos, subscription-manager
Error getting repository data for rhel-7-server-satellite-maintenance-6.11.2-rpms, repository not found
Uploading Enabled Repositories Report
Loaded plugins: product-id, subscription-manager
~~~
On RHEL 8:
~~
/ Enabling repositories [FAIL]
Failed executing subscription-manager repos --enable=rhel-8-for-x86_64-baseos-rpms --enable=rhel-8-for-x86_64-appstream-rpms --enable=satellite-maintenance-6.11.2-for-rhel-8-x86_64-rpms, exit status 1:
Error: 'satellite-maintenance-6.11.2-for-rhel-8-x86_64-rpms' does not match a valid repository ID. Use "subscription-manager repos --list" to see valid repositories.
Repository 'rhel-8-for-x86_64-baseos-rpms' is enabled for this system.
Repository 'rhel-8-for-x86_64-appstream-rpms' is enabled for this system.
--------------------------------------------------------------------------------
~~
As we can see, it tries to enable 6.11.2 instead of 6.12 which is not correct.
Expected results:
If the next major version ( 6.12 ) is not available, the command should immediately stop it's execution.
the next major version ( 6.12 ) is available then the command should try to enable the right maintenance repo for 6.12
Additional info:
From a small testing, the main root cause seems to be the way 6.11.1.1 and 6.11.1 is being processed by the .bump method ruby.
- foreman-rake console
API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.
Loading production environment (Rails 6.0.4.7)
irb(main):002:0> Gem::Version.new('6.11.1.1').bump
=> #<Gem::Version "6.11.2">
irb(main):003:0> Gem::Version.new('6.11.1.0').bump
=> #<Gem::Version "6.11.2">
irb(main):004:0> Gem::Version.new('6.11.1').bump
=> #<Gem::Version "6.12">
irb(main):005:0> Gem::Version.new('6.11.0').bump
=> #<Gem::Version "6.12">
irb(main):006:0> Gem::Version.new('6.11').bump
=> #<Gem::Version "7">
irb(main):007:0> exit
Updated by The Foreman Bot over 2 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman_maintain/pull/636 added
Updated by Amit Upadhye over 2 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset foreman_maintain|6534d7d3abd140b1a4b3a32227ae53fcf192cad9.
Updated by The Foreman Bot about 2 years ago
- Pull request https://github.com/theforeman/foreman_maintain/pull/645 added
Updated by The Foreman Bot about 2 years ago
- Pull request https://github.com/theforeman/foreman_maintain/pull/646 added
Updated by The Foreman Bot about 2 years ago
- Pull request https://github.com/theforeman/foreman_maintain/pull/648 added
Updated by The Foreman Bot about 2 years ago
- Pull request https://github.com/theforeman/foreman_maintain/pull/649 added
Updated by The Foreman Bot about 2 years ago
- Pull request https://github.com/theforeman/foreman_maintain/pull/650 added