Bug 2060396

Summary: satellite-maintain self-upgrade passes even if the next major version maintenance repository isn't available
Product: Red Hat Satellite Reporter: Gaurav Talreja <gtalreja>
Component: Satellite MaintainAssignee: Amit Upadhye <aupadhye>
Status: CLOSED ERRATA QA Contact: Gaurav Talreja <gtalreja>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.11.0CC: apatel, aupadhye, kgaikwad
Target Milestone: 6.11.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rubygem-foreman_maintain-1.0.4 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-07-05 14:34:01 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:
Bug Depends On:    
Bug Blocks: 2026415    

Description Gaurav Talreja 2022-03-03 12:40:59 UTC
Description of problem:
satellite-maintain self-upgrade command added in BZ 2026415 for updating rubygem-foreman_maintain from next stream
Here satellite-maintain self-upgrade passes even if the next major version maintenance repository isn't available in CDN 

Version-Release number of selected component (if applicable):
rubygem-foreman_maintain.noarch 1:1.0.3-1.el7sat

How reproducible:
Always

Steps to Reproduce:
1. foreman-maintain self-upgrade --target-version 7.0
2. or try any 7.x, # foreman-maintain self-upgrade --target-version 7.8
3.

Actual results:
self-upgrade pass even if repo not available

Expected results:
self-upgrade should fail to enable the next version repo if not available in CDN

Additional info:
In self-upgrade, we use yum-config-manager for el7 which returns nothing if fail to enable repo

D, [2022-03-03 07:34:49-0500 #38785] DEBUG -- : Running command yum-config-manager --disable foreman-maintain,rhel-7-server-ansible-2.9-rpms,rhel-7-server-rpms,rhel-7-server-satellite-maintenance-6-rpms,rhel-server-rhscl-7-rpms,sat-maintain,sat6,sat6tools7 with stdin nil
D, [2022-03-03 07:34:53-0500 #38785] DEBUG -- : Running command yum-config-manager --enable rhel-7-server-satellite-maintenance-7.0-rpms with stdin nil
D, [2022-03-03 07:35:27-0500 #38785] DEBUG -- : Running command yum-config-manager --enable foreman-maintain,rhel-7-server-ansible-2.9-rpms,rhel-7-server-rpms,rhel-7-server-satellite-maintenance-6-rpms,rhel-server-rhscl-7-rpms,sat-maintain,sat6,sat6tools7,rhel-7-server-satellite-maintenance-6-rpms with stdin nil

Comment 1 Bryan Kearney 2022-03-08 16:05:41 UTC
Upstream bug assigned to aupadhye

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

Comment 5 Gaurav Talreja 2022-04-08 11:11:57 UTC
Verified.

Tested on Satellite 6.11.0 Snap 15.0
Version: rubygem-foreman_maintain-1.0.6-1.el7sat.noarch

Steps:
1. # foreman-maintain self-upgrade --target-version 6.12

Observation:
Earlier yum-config-manager don't return anything, so it always passed when repo isn't available in CDN, now we using subscription-manager instead to enable repos that return the below error when repo isn't available.
--------------------------------------------------------------------------------
Enable repositories:
| Enabling repositories                                               [FAIL]
Failed executing subscription-manager repos --enable=rhel-7-server-satellite-maintenance-6.12-rpms, exit status 1:
 This system has no repositories available through subscriptions.
--------------------------------------------------------------------------------

Comment 8 errata-xmlrpc 2022-07-05 14:34:01 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 (Moderate: Satellite 6.11 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:5498