Bug 1771921

Summary: Package profiles sends too early when registering a client
Product: Red Hat Enterprise Linux 7 Reporter: Hao Chang Yu <hyu>
Component: subscription-managerAssignee: William Poteat <wpoteat>
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.7CC: aganbat, cdonnell, csnyder, jsefler, khowell, redakkan, swadeley, vsedmik, wpinheir, wpoteat
Target Milestone: rcKeywords: Triaged
Target Release: ---   
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-09-29 19:22:47 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 Hao Chang Yu 2019-11-13 09:09:25 UTC
Description of problem:
When registering a client with an activation key, subscription manager sends the combined profiles before attaching the subscriptions and enable repositories. This is causing Satellite unable to calculate the applicable errata correctly because Satellite thought that no repositories are bound to the client.


Steps to Reproduce:
1. Register a host with an activation key.

# subscription-manager register --org="redhat" --activationkey="my_key"

2. Check the redhat.repo. to confirm 1 repository is already enabled.

# grep -rin "enabled = 1" /etc/yum.repos.d/redhat.repo 
91:enabled = 1


3. Check the "/var/lib/rhsm/cache/profile.json" and notice that "enabled_repos" list is empty.

{"enabled_repos": [], "modulemd": [], "rpm": [{"vendor": "Red Hat, Inc.", "name": "python-firewall", "epoch": 0, "version": "0.5.3", "release": "5.el7", "arch": "noarch"}


4. Run the following command which will re-upload the profile correctly.

# subscription-manager repos --list


5. Check the "profile.json" file again and notice that the enabled repos are uploaded by now.

{"enabled_repos": [{"baseurl": ["https://hao-satellite64.usersys.redhat.com/pulp/repos/redhat/Library/content/dist/rhel/server/7/7Server/x86_64/os"], "repositoryid": "rhel-7-server-rpms"}], "modulemd": [], "rpm": [{"vendor": "Red Hat, Inc.", "name": "python-firewall", "epoch": 0, "version": "0.5.3", "release": "5.el7", "arch": "noarch"}


Actual results:
enabled repos not uploaded

Expected results:
enabled repos is uploaded

Comment 13 Craig Donnelly 2020-06-02 11:10:33 UTC
>>> Verifying against: subscription-manager-1.24.38-1.el7 with backend Satellite 6.6.

> Showing the failure:

[root@dhcp-13-226-235 ~]# rpm -q subscription-manager
subscription-manager-1.24.23-1.el7.x86_64

[root@dhcp-13-226-235 ~]# subscription-manager register --org Red_Hat --activationkey rhel7
The system has been registered with ID: ff9af5a7-913e-4d8b-b736-264eb32c1989
The registered system name is: dhcp-13-226-235.ml17.lab.eng.rdu.redhat.com
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

[root@dhcp-13-226-235 ~]# grep -rin "enabled = 1" /etc/yum.repos.d/redhat.repo 
22:enabled = 1

[root@dhcp-13-226-235 ~]# cat /var/lib/rhsm/cache/profile.json
{"enabled_repos": [], "modulemd": [], "rpm": [{"vendor": "Red Hat, Inc."<SNIP>
>>>>>>>>>>>>>>>>> ^^

>>> Updating sub-man:

> Showing cache not present
[root@dhcp-13-226-235 yum.repos.d]# head -c 50 /var/lib/rhsm/cache/profile.json
head: cannot open ‘/var/lib/rhsm/cache/profile.json’ for reading: No such file or directory

[root@dhcp-13-226-235 yum.repos.d]# yum update subscription-manager
Loaded plugins: product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.


This system is not registered with an entitlement server. You can use subscription-manager to register.

Resolving Dependencies
--> Running transaction check
---> Package subscription-manager.x86_64 0:1.24.23-1.el7 will be updated
---> Package subscription-manager.x86_64 0:1.24.38-1.el7 will be an update
--> Processing Dependency: subscription-manager-rhsm = 1.24.38 for package: subscription-manager-1.24.38-1.el7.x86_64
--> Running transaction check
---> Package subscription-manager-rhsm.x86_64 0:1.24.23-1.el7 will be updated
---> Package subscription-manager-rhsm.x86_64 0:1.24.38-1.el7 will be an update
--> Processing Dependency: subscription-manager-rhsm-certificates = 1.24.38-1.el7 for package: subscription-manager-rhsm-1.24.38-1.el7.x86_64
--> Running transaction check
---> Package subscription-manager-rhsm-certificates.x86_64 0:1.24.23-1.el7 will be updated
---> Package subscription-manager-rhsm-certificates.x86_64 0:1.24.38-1.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================
 Package                                  Arch     Version            Repository                                           Size
================================================================================================================================
Updating:
 subscription-manager                     x86_64   1.24.38-1.el7      brew-task-repo-subscription-manager-1.24.38-1.el7   1.1 M
Updating for dependencies:
 subscription-manager-rhsm                x86_64   1.24.38-1.el7      brew-task-repo-subscription-manager-1.24.38-1.el7   330 k
 subscription-manager-rhsm-certificates   x86_64   1.24.38-1.el7      brew-task-repo-subscription-manager-1.24.38-1.el7   239 k

Transaction Summary
================================================================================================================================
Upgrade  1 Package (+2 Dependent packages)

Total download size: 1.6 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/3): subscription-manager-rhsm-1.24.38-1.el7.x86_64.rpm                                                | 330 kB  00:00:00     
(2/3): subscription-manager-1.24.38-1.el7.x86_64.rpm                                                     | 1.1 MB  00:00:00     
(3/3): subscription-manager-rhsm-certificates-1.24.38-1.el7.x86_64.rpm                                   | 239 kB  00:00:00     
--------------------------------------------------------------------------------------------------------------------------------
Total                                                                                           1.9 MB/s | 1.6 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Updating   : subscription-manager-rhsm-certificates-1.24.38-1.el7.x86_64                                                  1/6 
  Updating   : subscription-manager-rhsm-1.24.38-1.el7.x86_64                                                               2/6 
  Updating   : subscription-manager-1.24.38-1.el7.x86_64                                                                    3/6 
  Cleanup    : subscription-manager-1.24.23-1.el7.x86_64                                                                    4/6 
  Cleanup    : subscription-manager-rhsm-1.24.23-1.el7.x86_64                                                               5/6 
  Cleanup    : subscription-manager-rhsm-certificates-1.24.23-1.el7.x86_64                                                  6/6 
  Verifying  : subscription-manager-1.24.38-1.el7.x86_64                                                                    1/6 
  Verifying  : subscription-manager-rhsm-certificates-1.24.38-1.el7.x86_64                                                  2/6 
  Verifying  : subscription-manager-rhsm-1.24.38-1.el7.x86_64                                                               3/6 
  Verifying  : subscription-manager-rhsm-certificates-1.24.23-1.el7.x86_64                                                  4/6 
  Verifying  : subscription-manager-rhsm-1.24.23-1.el7.x86_64                                                               5/6 
  Verifying  : subscription-manager-1.24.23-1.el7.x86_64                                                                    6/6 

Updated:
  subscription-manager.x86_64 0:1.24.38-1.el7                                                                                   

Dependency Updated:
  subscription-manager-rhsm.x86_64 0:1.24.38-1.el7         subscription-manager-rhsm-certificates.x86_64 0:1.24.38-1.el7        

Complete!
[root@dhcp-13-226-235 yum.repos.d]# subscription-manager register --org Red_Hat --activationkey rhel7
The system has been registered with ID: 545efb43-c850-4d61-8dba-4d488f231ce1
The registered system name is: dhcp-13-226-235.ml17.lab.eng.rdu.redhat.com

Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

[root@dhcp-13-226-235 yum.repos.d]# grep -rin "enabled = 1" /etc/yum.repos.d/redhat.repo
22:enabled = 1

[root@dhcp-13-226-235 yum.repos.d]# head -c 200 /var/lib/rhsm/cache/profile.json
{"enabled_repos": [{"baseurl": ["https://cragsat66.usersys.redhat.com/pulp/repos/Red_Hat/Library/content/dist/rhel/server/7/7Server/x86_64/os"], "repositoryid": "rhel-7-server-rpms"}], "modulemd": [],<SNIP>

> repos are present ^

VERIFIED.

Comment 15 errata-xmlrpc 2020-09-29 19:22:47 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 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:3866