Bug 1486445

Summary: foreman-maintain upgrade fails to properly enable 6.2 repos
Product: Red Hat Satellite Reporter: Mike McCune <mmccune>
Component: Satellite MaintainAssignee: Anurag Patel <apatel>
Status: CLOSED ERRATA QA Contact: Nikhil Kathole <nkathole>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.1.11CC: bbuckingham, ehelms, inecas, nkathole, sghai
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: foreman-maintain-0.0.9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-19 17:22:26 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: 1496794    

Description Mike McCune 2017-08-29 18:40:20 UTC
Have a 6.1 instance trying to upgrade and it attempts to enable non-existent repositories:

# ./bin/foreman-maintain upgrade  run  --target-version 6.2 --whitelist=disk-io
...
Running migration scripts to Satellite 6.2
================================================================================
Setup repositories: 
| Configuring repositories for 6.2                                    [FAIL]    
Failed executing subscription-manager repos --enable=rhel-18-server-rpms --enable=rhel-18-rhscl-18-rpms --enable=rhel-18-server-satellite-6.2-rpms, exit status 1:
 Error: 'rhel-18-server-rpms' does not match a valid repository ID. Use "subscription-manager repos --list" to see valid repositories.
Error: 'rhel-18-rhscl-18-rpms' does not match a valid repository ID. Use "subscription-manager repos --list" to see valid repositories.
Error: 'rhel-18-server-satellite-6.2-rpms' does not match a valid repository ID. Use "subscription-manager repos --list" to see valid repositories.

I'm not sure where this '18' is coming from but that doesn't map to anything available.

Comment 2 Mike McCune 2017-08-29 18:49:58 UTC
Looks like the parsing from the RPM string is off:


# rpm -qf /etc/redhat-release
redhat-release-server-7.4-18.el7.x86_64

it is getting the '18' vs the 7.4

we also really do NOT want to use 7.4 and want to use 7Server or 6Server. Never pin to a specific version of RHEL as there won't ever exist a repo-id for:

rhel-7.4-server-satellite-6.2-rpms

and instead we only have:

rhel-7-server-satellite-6.2-rpms

I'd suggest switching to facter vs parsing the RPM:

# facter operatingsystemmajrelease
7

Comment 3 Mike McCune 2017-08-29 19:53:20 UTC
we also have the wrong repo-id for the SCL:

 Error: 'rhel-7-rhscl-7-rpms' does not match a valid repository ID. Use "subscription-manager repos --list" to see valid repositories.


it is:

 rhel-server-rhscl-7-rpms 

no need for the extra 7

Comment 4 Sachin Ghai 2017-09-05 12:46:41 UTC
Yeah, I hit the same issue today on rhel6 system:

 Error: 'rhel-6-rhscl-6-rpms' does not match a valid repository ID.

it should be: rhel-server-rhscl-6-rpms

Comment 5 Nikhil Kathole 2017-12-19 10:44:53 UTC
VERIFIED

Version Tested:
# rpm -q rubygem-foreman_maintain
rubygem-foreman_maintain-0.1.1-1.el7sat.noarch

D, [2017-12-19 05:39:08-0500 #107219] DEBUG -- : Running command subscription-manager repos --enable=rhel-7-server-rpms --enable=rhel-server-rhscl-7-rpms --enable=rhel-7-server-satellite-6.2-rpms with stdin nil
D, [2017-12-19 05:39:18-0500 #107219] DEBUG -- : output of the command:
 Repository 'rhel-7-server-rpms' is enabled for this system.
Repository 'rhel-7-server-satellite-6.2-rpms' is enabled for this system.
Repository 'rhel-server-rhscl-7-rpms' is enabled for this system.

Upgrading from 6.1 to 6.2 on rhel 7 correctly enabled the repositories.

Comment 8 errata-xmlrpc 2018-02-19 17:22:26 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, 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/RHBA-2018:0330