Bug 2115832 - Running "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"
Summary: Running "satellite-maintain self-upgrade" on a Satellite\Capsule 6.11.1.1 fai...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Satellite Maintain
Version: 6.11.1
Hardware: All
OS: All
unspecified
high
Target Milestone: 6.12.0
Assignee: Amit Upadhye
QA Contact: Gaurav Talreja
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-08-05 14:00 UTC by Sayan Das
Modified: 2022-11-28 10:13 UTC (History)
11 users (show)

Fixed In Version: rubygem-foreman_maintain-1.1.8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2131763 (view as bug list)
Environment:
Last Closed: 2022-11-16 13:35:13 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 35404 0 Normal Closed Running "satellite-maintain self-upgrade" on a Satellite\Capsule 6.11.1.1 fails with error "Error: 'satellite-maintenanc... 2022-08-31 10:55:33 UTC
Red Hat Issue Tracker SAT-12350 0 None None None 2022-08-22 10:59:18 UTC
Red Hat Product Errata RHSA-2022:8506 0 None None None 2022-11-16 13:35:22 UTC

Description Sayan Das 2022-08-05 14:00:32 UTC
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

Comment 3 Bryan Kearney 2022-08-25 16:05:13 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/35404 has been resolved.

Comment 8 Gaurav Talreja 2022-09-30 08:29:04 UTC
Hi, 

Since we don't have 6.12.0.x at the moment, it's not possible to test it on 6.12. Alternatively, I patched 6.11.1.1 with this fix and got below error, is this expected or should the issue be moved back to ASSIGNED?

# foreman-maintain self-upgrade
undefined method `bump' for "6.11":String

Thanks,
Gaurav

Comment 9 Gaurav Talreja 2022-10-04 11:51:28 UTC
@ehelms Since Amit is not around, could you please take a look at the issue in comment 8?

Comment 10 Evgeni Golov 2022-10-04 11:57:40 UTC
@gtalreja please failQA this one, there is more work needed: https://github.com/theforeman/foreman_maintain/pull/648

Comment 11 Gaurav Talreja 2022-10-04 12:08:12 UTC
Evgeni, Thanks for the confirmation, moving this back to ASSIGNED.

Comment 12 Brad Buckingham 2022-10-06 12:56:28 UTC
The patch posted in comment 10 is now merged.  Thanks Evgeni!

Comment 13 Gaurav Talreja 2022-10-07 16:49:26 UTC
Verified

Tested on Satellite 6.12.0 Snap 14.0
Version: rubygem-foreman_maintain-1.1.8-1.el8sat.noarch

Steps:
Applied this fix on 6.11.1.1/6.12.0 and ran "foreman-maintain self-upgrade"

Observation
For 6.11.1.1, self-upgrade enables 6.12 maintenance repo and for 6.12.0, self-upgrade enables 6.13 maintenance repo

Comment 17 errata-xmlrpc 2022-11-16 13:35:13 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: Satellite 6.12 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:8506


Note You need to log in before you can comment on or make changes to this bug.