Bug 1855893

Summary: full_refresh_on_yum=1 does not appear to update the repo-overrides in redhat.repo after a yum transaction
Product: Red Hat Enterprise Linux 8 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Jiri Hnidek <jhnidek>
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: high Docs Contact:
Priority: high    
Version: 8.3CC: csnyder, jhnidek, lmiksik, redakkan
Target Milestone: rcKeywords: Regression, Triaged
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-04 01:39:41 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: 1842946    

Description John Sefler 2020-07-10 20:44:23 UTC
Description of problem:

According to the man page description for full_refresh_on_yum in rhsm.conf...
[root@kvm-07-guest08 ~]# man -P cat rhsm.conf | grep full_refresh_on_yum -A5
       full_refresh_on_yum
           Set to 1 if the /etc/yum.repos.d/redhat.repo should be updated
           with every server command. This will make yum less efficient, but
           can ensure that the most recent data is brought down from the
           subscription service.

With this information, a test was created that follows these steps
1. assert the default full_refresh_on_yum is set to 0
2. register and auto-attach a subscription that provides access to any content set repo
3. use subscription-manager repos-override to enable a repo and add some overrides to the repo
4. run the consumer's first yum transaction
5. verify that the repos-override are reflected in redhat.repo
6. remove the /var/lib/rhsm/cache/content_overrides.json
7. run the consumer's second yum transaction
8. verify that the repos-overrides are NOT reflected in redhat.repo because full_refresh_on_yum is set to 0
9. set full_refresh_on_yum to 1
10. run the consumer's third yum transaction
11. verify that the repos-overrides are RESTORED in redhat.repo because full_refresh_on_yum is set to 1

This last step is the one that is failing.  Despite the full_refresh_on_yum=1 setting, running a yum transaction is not restoring the most recent data from the server as the man page suggests that it should.

Moreover... this is a regression from RHEL-8.2 behavior.



Version-Release number of selected component (if applicable):
[root@kvm-06-guest10 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 3.1.15-1
subscription management rules: 5.40
subscription-manager: 1.27.9-1.el8


How reproducible:
always on RHEL-8.3, not on RHEL-8.2; not on RHEL-7.9


Steps to Reproduce:
[root@kvm-06-guest10 ~]# subscription-manager config --rhsm.full_refresh_on_yum=0
[root@kvm-06-guest10 ~]# subscription-manager config | egrep "full_refresh_on_yum|Default"
   full_refresh_on_yum = [0]
[] - Default value in use

[root@kvm-06-guest10 ~]# subscription-manager register --auto-attach
Registering to: subscription.rhsm.redhat.com:443/subscription
Username: rhelentqe
Password: 
The system has been registered with ID: 845c2728-31e3-4049-b797-5a72e8e7989a
The registered system name is: kvm-06-guest10.hv2.lab.eng.bos.redhat.com
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux for x86_64 Beta
Status:       Subscribed

[root@kvm-06-guest10 ~]# subscription-manager repos --list-disabled | grep rhel-8-for-x86_64-supplementary-beta-rpms -A4
Repo ID:   rhel-8-for-x86_64-supplementary-beta-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - Supplementary Beta (RPMs)
Repo URL:  https://cdn.redhat.com/content/beta/rhel8/8/x86_64/supplementary/os
Enabled:   0

[root@kvm-06-guest10 ~]# subscription-manager repo-override --repo=rhel-8-for-x86_64-supplementary-beta-rpms --add=retries:5 --add=timeout:40 --add=enabled:true
[root@kvm-06-guest10 ~]# subscription-manager repo-override --list
Repository: rhel-8-for-x86_64-supplementary-beta-rpms
  enabled: true
  retries: 5
  timeout: 40

[root@kvm-06-guest10 ~]# yum repolist
Updating Subscription Management repositories.
repo id                                                                      repo name
rhel-8-for-x86_64-appstream-beta-rpms                                        Red Hat Enterprise Linux 8 for x86_64 - AppStream Beta (RPMs)
rhel-8-for-x86_64-baseos-beta-rpms                                           Red Hat Enterprise Linux 8 for x86_64 - BaseOS Beta (RPMs)
rhel-8-for-x86_64-supplementary-beta-rpms                                    Red Hat Enterprise Linux 8 for x86_64 - Supplementary Beta (RPMs)
[root@kvm-06-guest10 ~]# 
[root@kvm-06-guest10 ~]# grep rhel-8-for-x86_64-supplementary-beta-rpms /etc/yum.repos.d/redhat.repo -A14
[rhel-8-for-x86_64-supplementary-beta-rpms]
name = Red Hat Enterprise Linux 8 for x86_64 - Supplementary Beta (RPMs)
baseurl = https://cdn.redhat.com/content/beta/rhel8/8/x86_64/supplementary/os
enabled = true
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release,https://cdn.redhat.com/foo
sslverify = 1
sslcacert = /etc/rhsm/ca/redhat-uep.pem
sslclientkey = /etc/pki/entitlement/3376927769827168818-key.pem
sslclientcert = /etc/pki/entitlement/3376927769827168818.pem
metadata_expire = 86400
enabled_metadata = 0
retries = 5
timeout = 40

[root@kvm-06-guest10 ~]# rm /var/lib/rhsm/cache/content_overrides.json
rm: remove regular file '/var/lib/rhsm/cache/content_overrides.json'? y

[root@kvm-06-guest10 ~]# yum repolist
Updating Subscription Management repositories.
repo id                                                                      repo name
rhel-8-for-x86_64-appstream-beta-rpms                                        Red Hat Enterprise Linux 8 for x86_64 - AppStream Beta (RPMs)
rhel-8-for-x86_64-baseos-beta-rpms                                           Red Hat Enterprise Linux 8 for x86_64 - BaseOS Beta (RPMs)
[root@kvm-06-guest10 ~]# 
[root@kvm-06-guest10 ~]# grep rhel-8-for-x86_64-supplementary-beta-rpms /etc/yum.repos.d/redhat.repo -A12
[rhel-8-for-x86_64-supplementary-beta-rpms]
name = Red Hat Enterprise Linux 8 for x86_64 - Supplementary Beta (RPMs)
baseurl = https://cdn.redhat.com/content/beta/rhel8/8/x86_64/supplementary/os
enabled = 0
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release,https://cdn.redhat.com/foo
sslverify = 1
sslcacert = /etc/rhsm/ca/redhat-uep.pem
sslclientkey = /etc/pki/entitlement/3376927769827168818-key.pem
sslclientcert = /etc/pki/entitlement/3376927769827168818.pem
metadata_expire = 86400
enabled_metadata = 0

[root@kvm-06-guest10 ~]# subscription-manager config --rhsm.full_refresh_on_yum=1
[root@kvm-06-guest10 ~]# subscription-manager config | egrep "full_refresh_on_yum|Default"
   full_refresh_on_yum = 1
[] - Default value in use
[root@kvm-06-guest10 ~]# 

[root@kvm-06-guest10 ~]# yum repolist
Updating Subscription Management repositories.
repo id                                                                      repo name
rhel-8-for-x86_64-appstream-beta-rpms                                        Red Hat Enterprise Linux 8 for x86_64 - AppStream Beta (RPMs)
rhel-8-for-x86_64-baseos-beta-rpms                                           Red Hat Enterprise Linux 8 for x86_64 - BaseOS Beta (RPMs)
[root@kvm-06-guest10 ~]# 
[root@kvm-06-guest10 ~]# grep rhel-8-for-x86_64-supplementary-beta-rpms /etc/yum.repos.d/redhat.repo -A12
[rhel-8-for-x86_64-supplementary-beta-rpms]
name = Red Hat Enterprise Linux 8 for x86_64 - Supplementary Beta (RPMs)
baseurl = https://cdn.redhat.com/content/beta/rhel8/8/x86_64/supplementary/os
enabled = 0
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release,https://cdn.redhat.com/foo
sslverify = 1
sslcacert = /etc/rhsm/ca/redhat-uep.pem
sslclientkey = /etc/pki/entitlement/3376927769827168818-key.pem
sslclientcert = /etc/pki/entitlement/3376927769827168818.pem
metadata_expire = 86400
enabled_metadata = 0

[root@kvm-06-guest10 ~]# subscription-manager repo-override
Repository: rhel-8-for-x86_64-supplementary-beta-rpms
  enabled: true
  retries: 5
  timeout: 40



Actual results:
  above

Expected results:
  expected the last call to "yum repolist" to restore the missing cache for /var/lib/rhsm/cache/content_overrides.json because rhsm.full_refresh_on_yum=1 was configured.


Additional info:
  Despite an active repo-override list and a configuration of full_refresh_on_yum=1, none of the overrides are restored to the redhat.repo after a yum transaction.  This is the point of this bugzilla.

Comment 4 John Sefler 2020-08-20 19:14:40 UTC
Verifying Version....

[root@kvm-06-guest33 ~]# rpm -q subscription-manager
subscription-manager-1.27.14-1.el8.x86_64
[root@kvm-06-guest33 ~]# rpm -q subscription-manager --changelog | grep 1855893
- 1855893: Generate redhat.repo properly; ENT-2636 (jhnidek)


Steps to Test...

[root@kvm-06-guest33 ~]# subscription-manager config --rhsm.full_refresh_on_yum=0
[root@kvm-06-guest33 ~]# subscription-manager config --list | egrep "full_refresh_on_yum|Default"
   full_refresh_on_yum = [0]
[] - Default value in use

[root@kvm-06-guest33 ~]# subscription-manager register --auto-attach
Registering to: subscription.rhsm.redhat.com:443/subscription
Username: rhelentqe
Password: 
The system has been registered with ID: 871f6d46-a45b-4559-8e8a-21bab5df9919
The registered system name is: kvm-06-guest33.hv2.lab.eng.bos.redhat.com
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux for x86_64 High Touch Beta
Status:       Subscribed

[root@kvm-06-guest33 ~]# subscription-manager repos --list-disabled | grep -A4 rhel-8-for-x86_64-highavailability-htb-rpms
Repo ID:   rhel-8-for-x86_64-highavailability-htb-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - High Availability HTB (RPMs)
Repo URL:  https://cdn.redhat.com/content/htb/rhel8/8/x86_64/highavailability/os
Enabled:   0

[root@kvm-06-guest33 ~]# subscription-manager repo-override --repo=rhel-8-for-x86_64-highavailability-htb-rpms --add=retries:5 --add=timeout:40 --add=enabled:true
[root@kvm-06-guest33 ~]# subscription-manager repo-override --list
Repository: rhel-8-for-x86_64-highavailability-htb-rpms
  enabled: true
  retries: 5
  timeout: 40

[root@kvm-06-guest33 ~]# yum repolist
Updating Subscription Management repositories.
repo id                                                        repo name
rhel-8-for-x86_64-appstream-htb-rpms                           Red Hat Enterprise Linux 8 for x86_64 - AppStream HTB (RPMs)
rhel-8-for-x86_64-baseos-htb-rpms                              Red Hat Enterprise Linux 8 for x86_64 - BaseOS HTB (RPMs)
rhel-8-for-x86_64-highavailability-htb-rpms                    Red Hat Enterprise Linux 8 for x86_64 - High Availability HTB (RPMs)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PASSED: As expected rhel-8-for-x86_64-highavailability-htb-rpms is available since we added the enabled:true as a repo-override

[root@kvm-06-guest33 ~]# grep rhel-8-for-x86_64-highavailability-htb-rpms /etc/yum.repos.d/redhat.repo -A14
[rhel-8-for-x86_64-highavailability-htb-rpms]
name = Red Hat Enterprise Linux 8 for x86_64 - High Availability HTB (RPMs)
baseurl = https://cdn.redhat.com/content/htb/rhel8/8/x86_64/highavailability/os
enabled = true
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
sslverify = 1
sslcacert = /etc/rhsm/ca/redhat-uep.pem
sslclientkey = /etc/pki/entitlement/4722886298080466843-key.pem
sslclientcert = /etc/pki/entitlement/4722886298080466843.pem
metadata_expire = 86400
enabled_metadata = 0
retries = 5
timeout = 40

[root@kvm-06-guest33 ~]# rm /var/lib/rhsm/cache/content_overrides.json
rm: remove regular file '/var/lib/rhsm/cache/content_overrides.json'? y

[root@kvm-06-guest33 ~]# yum repolist
Updating Subscription Management repositories.
repo id                                                         repo name
rhel-8-for-x86_64-appstream-htb-rpms                            Red Hat Enterprise Linux 8 for x86_64 - AppStream HTB (RPMs)
rhel-8-for-x86_64-baseos-htb-rpms                               Red Hat Enterprise Linux 8 for x86_64 - BaseOS HTB (RPMs)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PASSED: As expected rhel-8-for-x86_64-highavailability-htb-rpms is NOT available since we forcibly removed it from the cached overrides and because rhsm.full_refresh_on_yum=0, the yum transaction was blocked from refreshing the cache

[root@kvm-06-guest33 ~]# subscription-manager config --rhsm.full_refresh_on_yum=1
[root@kvm-06-guest33 ~]# subscription-manager config --list | egrep "full_refresh_on_yum|Default"
   full_refresh_on_yum = 1
[] - Default value in use
[root@kvm-06-guest33 ~]# 
[root@kvm-06-guest33 ~]# yum repolist
Updating Subscription Management repositories.
repo id                                                        repo name
rhel-8-for-x86_64-appstream-htb-rpms                           Red Hat Enterprise Linux 8 for x86_64 - AppStream HTB (RPMs)
rhel-8-for-x86_64-baseos-htb-rpms                              Red Hat Enterprise Linux 8 for x86_64 - BaseOS HTB (RPMs)
rhel-8-for-x86_64-highavailability-htb-rpms                    Red Hat Enterprise Linux 8 for x86_64 - High Availability HTB (RPMs)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PASSED & VERIFIED: As expected rhel-8-for-x86_64-highavailability-htb-rpms is NOW available since we set rhsm.full_refresh_on_yum=1 which told the yum repolist to refresh redhat.repo and update its cache

This bug is fixed.

Comment 7 errata-xmlrpc 2020-11-04 01:39:41 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/RHBA-2020:4460