Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2115832

Summary: 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"
Product: Red Hat Satellite Reporter: Sayan Das <saydas>
Component: Satellite MaintainAssignee: Amit Upadhye <aupadhye>
Status: CLOSED ERRATA QA Contact: Gaurav Talreja <gtalreja>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.11.1CC: ahumbe, apatel, aupadhye, bbuckingham, bkearney, egolov, ehelms, gtalreja, kgaikwad, pcreech, rdesouza
Target Milestone: 6.12.0Keywords: Triaged
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: rubygem-foreman_maintain-1.1.8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2131763 (view as bug list) Environment:
Last Closed: 2022-11-16 13:35:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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