Bug 2074111

Summary: subscription-manager release setting is not landing in the redhat.repo file [rhel-8.7.0]
Product: Red Hat Enterprise Linux 8 Reporter: RHEL Program Management Team <pgm-rhel-tools>
Component: subscription-managerAssignee: Pino Toscano <ptoscano>
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 8.6CC: candlepin-bugs, cdonnell, jhnidek, jsefler, pvlasin, redakkan
Target Milestone: rcKeywords: Regression, Triaged
Target Release: 8.7   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: subscription-manager-1.28.30-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2073558 Environment:
Last Closed: 2022-11-08 10:48:23 UTC Type: ---
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: 2073558    
Bug Blocks:    

Comment 1 Rehana 2022-04-25 12:05:01 UTC
# subscription-manager version
server type: This system is currently not registered.
subscription management server: 3.2.22-1
subscription management rules: 5.41
subscription-manager: 1.28.29-1.git.22.704860e.el8

# subscription-manager register 
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: sca_rhsm_1
Password: 
The system has been registered with ID: b2b387a0-0907-4d78-a9db-03be7577dccb
The registered system name is: kvm-01-guest06.lab.eng.rdu2.redhat.com

# subscription-manager repos --list-enabled
+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID:   rhel-8-for-x86_64-appstream-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)
Repo URL:  https://cdn.stage.redhat.com/content/dist/rhel8/$releasever/x86_64/appstream/os
Enabled:   1

Repo ID:   rhel-8-for-x86_64-baseos-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)
Repo URL:  https://cdn.stage.redhat.com/content/dist/rhel8/$releasever/x86_64/baseos/os
Enabled:   1

# subscription-manager release --list
+-------------------------------------------+
          Available Releases
+-------------------------------------------+
8
8.0
8.1
8.2
8.3
8.4
8.5
8.6
8.7

# subscription-manager release --set=8.6
Release set to: 8.6

# subscription-manager repos --list-enabled
+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID:   rhel-8-for-x86_64-appstream-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)
Repo URL:  https://cdn.stage.redhat.com/content/dist/rhel8/8.6/x86_64/appstream/os
Enabled:   1

Repo ID:   rhel-8-for-x86_64-baseos-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)
Repo URL:  https://cdn.stage.redhat.com/content/dist/rhel8/8.6/x86_64/baseos/os
Enabled:   1

ˆ^Notice the $releasever is the repo url was replaced by the release version set on the system. Based on the observation , pre verifying the bug

Comment 6 Rehana 2022-06-14 10:17:49 UTC
Final verification on :
======================

//In order to demonstrate the release list we need to have GA certificate on the system. Currently I m manually placing the GA certificate for the verification purpose. Also using stage environments to demo the verification steps 
# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 4.0.18-1
subscription management rules: 5.41
subscription-manager: 1.28.30-1.el8

# subscription-manager register
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: sca_rhsm_1
Password: 
The system has been registered with ID: *******
The registered system name is: *******

# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name: Red Hat Enterprise Linux for x86_64
Product ID:   479
Version:      8.7
Arch:         x86_64

# subscription-manager repos --list-enabled
+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID:   rhel-8-for-x86_64-baseos-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)
Repo URL:  https://cdn.stage.redhat.com/content/dist/rhel8/$releasever/x86_64/baseos/os
Enabled:   1

Repo ID:   rhel-8-for-x86_64-appstream-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)
Repo URL:  https://cdn.stage.redhat.com/content/dist/rhel8/$releasever/x86_64/appstream/os
Enabled:   1

# grep '$releasever' /etc/yum.repos.d/redhat.repo | wc --lines
15

ˆ^Notice $releasever was present in the redhat.repo prior to setting release version on the system

# subscription-manager release --list
+-------------------------------------------+
          Available Releases
+-------------------------------------------+
8
8.0
8.1
8.2
8.3
8.4
8.5
8.6
8.7

# subscription-manager release --set=8.7
Release set to: 8.7

# grep '$releasever' /etc/yum.repos.d/redhat.repo | wc --lines
0

ˆAfter the release version was set on the system, all the reference to $releasever was replaced by the actual value configured on the system

# subscription-manager repos --list-enabled
+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID:   rhel-8-for-x86_64-appstream-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)
Repo URL:  https://cdn.stage.redhat.com/content/dist/rhel8/8.7/x86_64/appstream/os
Enabled:   1

Repo ID:   rhel-8-for-x86_64-baseos-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)
Repo URL:  https://cdn.stage.redhat.com/content/dist/rhel8/8.7/x86_64/baseos/os
Enabled:   1

# cat /var/lib/rhsm/cache/releasever.json
{"releaseVer": "8.7"}

Based on the observations now the user can successfully set release version on the system. Hence verifying the bug.

Comment 8 errata-xmlrpc 2022-11-08 10:48:23 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 (subscription-manager bug fix and enhancement update), 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/RHEA-2022:7719