Bug 1613454

Summary: [RHEL76] dnf plugins from dnf-plugin-subscription-manager are not loaded by the default dnf config
Product: Red Hat Enterprise Linux 7 Reporter: Rehana <redakkan>
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: high Docs Contact:
Priority: high    
Version: 7.6CC: csnyder, jsefler
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: 2018-10-30 10:37:37 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: 1558411, 1615433    

Description Rehana 2018-08-07 15:11:04 UTC
Description of problem:
dnf plugins provided by dnf-plugin-subscription-manager are not loaded by default

Version-Release number of selected component (if applicable):
dnf-plugin-subscription-manager-1.21.5-7.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
1.Since yum and dnf can co-exist on RHEL76 , make sure the all the yum plugins are disabled (to make sure the dnf is not using the file that are already populated by yum ) 

[root@ibm-x3650m4-01-vm-12 pluginconf.d]# subscription-manager config --list | grep auto_enable
   auto_enable_yum_plugins = 0

[root@ibm-x3650m4-01-vm-12 pluginconf.d]# cat /etc/yum/pluginconf.d/search-disabled-repos.conf | grep enabled
enabled=0

[root@ibm-x3650m4-01-vm-12 pluginconf.d]# cat /etc/yum/pluginconf.d/subscription-manager.conf | grep enabled
enabled=0

[root@ibm-x3650m4-01-vm-12 pluginconf.d]# cat /etc/yum/pluginconf.d/product-id.conf | grep enabled
enabled=0

[root@ibm-x3650m4-01-vm-12 pluginconf.d]# subscription-manager unregister
This system is currently not registered.
[root@ibm-x3650m4-01-vm-12 pluginconf.d]# yum clean all 
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 To enable Red Hat Subscription Management repositories:
     subscription-manager repos --enable <repo>
 To enable custom repositories:
     yum-config-manager --enable <repo>

[root@ibm-x3650m4-01-vm-12 pluginconf.d]# dnf clean all
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
8 files removed


2. Now register and auto-attach the system 
# subscription-manager register --auto-attach
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: stage_test_rhel74
Password: 
The system has been registered with ID: 1f391b8f-c6d0-4f28-8598-5cd878b99595
The registered system name is: ibm-x3650m4-01-vm-12.lab.eng.bos.redhat.com
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

3) Delete the redhat.repo file ( only to be tried on rhel76, as the redhat.repo file is already populated by yum)

4) dnf replist -d3 

Actual results:
# dnf repolist -d3
Loaded plugins: builddep, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, repoclosure, repograph, repomanage, reposync
DNF version: 2.7.5
cachedir: /var/cache/dnf
No repositories available

None of plugins provided by dnf-plugin-subscription-manager is listed such as product-id and subscription-manager

# rpm -ql dnf-plugin-subscription-manager | grep plugins/ | egrep .py$
/usr/lib64/python2.7/site-packages/dnf-plugins/product-id.py
/usr/lib64/python2.7/site-packages/dnf-plugins/subscription-manager.py

Expected results:

plugins should load by default


Additional info:
To work around for this problem. If we alter the default dnf pluginpath, then product-id and subscription-manager plugins will load...

# echo 'pluginpath=/usr/lib64/python2.7/site-packages/dnf-plugins,/usr/lib/python2.7/site-packages/dnf-plugins' >> /etc/dnf/dnf.conf

# cat /etc/dnf/dnf.conf 
[main]
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True
pluginpath=/usr/lib64/python2.7/site-packages/dnf-plugins,/usr/lib/python2.7/site-packages/dnf-plugins

# dnf repolist -d3
Loaded plugins: builddep, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, product-id, repoclosure, repograph, repomanage, reposync, subscription-manager
DNF version: 2.7.5

Comment 3 Rehana 2018-08-20 09:58:14 UTC
Reproducer :
===========

# rpm -qa subsc* dnf* | sort
dnf-2.7.5-17.el7.noarch
dnf-data-2.7.5-17.el7.noarch
dnf-plugins-core-2.1.5-5.el7.noarch
dnf-plugin-subscription-manager-1.21.5-7.el7.x86_64
subscription-manager-1.21.5-7.el7.x86_64
subscription-manager-rhsm-1.21.5-7.el7.x86_64
subscription-manager-rhsm-certificates-1.21.5-7.el7.x86_64

1.Disable all yum plugins 

#subscription-manager config --list | grep auto_enable
   auto_enable_yum_plugins = 0

# cat /etc/yum/pluginconf.d/search-disabled-repos.conf | grep enabled
enabled=0
# Repositories matching the patterns listed in ignored_repos will not be enabled by the plugin

# cat /etc/yum/pluginconf.d/subscription-manager.conf | grep enabled
enabled=0

# cat /etc/yum/pluginconf.d/product-id.conf | grep enabled
enabled=0

2. Register and attach subscription

# subscription-manager register --auto-attach
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: stage_test_rhel74
Password: 
The system has been registered with ID: a2e95a09-359a-4b2b-a854-f656da1c9106
The registered system name is: ibm-x3650m4-01-vm-14.lab.eng.bos.redhat.com
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

3.Delete the redhat.repo populated 

# rm -rf /etc/yum.repos.d/redhat.repo

4.Execute dnf repolist

# dnf repolist -d3 
Loaded plugins: builddep, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, repoclosure, repograph, repomanage, reposync
DNF version: 2.7.5
cachedir: /var/cache/dnf
No repositories available

^^ Observed that the subscription manager dnf plugins "product-id" and "subscription-manager" are not loaded by default

Comment 4 Rehana 2018-08-20 10:04:42 UTC
Verifying on :
==============
# rpm -qa subsc* dnf* | sort
dnf-2.7.5-17.el7.noarch
dnf-data-2.7.5-17.el7.noarch
dnf-plugins-core-2.1.5-5.el7.noarch
dnf-plugin-subscription-manager-1.21.7-1.el7.x86_64
subscription-manager-1.21.7-1.el7.x86_64
subscription-manager-rhsm-1.21.7-1.el7.x86_64
subscription-manager-rhsm-certificates-1.21.7-1.el7.x86_64

Note:Install dnf-plugin-subscription manager and its dependencies from Extras repo.

1. Make sure all the yum plugin are disabled on the system 

# subscription-manager config --list | grep auto_enable
   auto_enable_yum_plugins = 0

# cat /etc/yum/pluginconf.d/search-disabled-repos.conf | grep enabled
enabled=0
# Repositories matching the patterns listed in ignored_repos will not be enabled by the plugin

# cat /etc/yum/pluginconf.d/subscription-manager.conf | grep enabled
enabled=0

#  cat /etc/yum/pluginconf.d/product-id.conf | grep enabled
enabled=0

2. Register and attach subscription

# subscription-manager register --auto-attach
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: stage_test_rhel74
Password: 
The system has been registered with ID: 2dd800bd-4346-4cff-83d4-9714618696b6
The registered system name is: cisco-b22m3-01.rhts.eng.bos.redhat.com
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

3.Remove the redhat.repo file from the system 

# rm -rf redhat.repo

4.Execute dnf repolist -d3 

# dnf repolist -d3
Loaded plugins: builddep, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, product-id, repoclosure, repograph, repomanage, reposync, subscription-manager
Updating Subscription Management repositories.
DNF version: 2.7.5
cachedir: /var/cache/dnf
Updating Subscription Management repositories.
Red Hat Enterprise Linux 7 Server (RPMs)                                                                                                                                            33 MB/s |  62 MB     00:01    
Last metadata expiration check: 0:00:27 ago on Monday 20 August 2018 05:38:04 AM EDT.
repo id                                                                                    repo name                                                                                                         status
rhel-7-server-rpms                                                                         Red Hat Enterprise Linux 7 Server (RPMs)                                                                          20,891

Observed that "subscription-manager" and "product-id" plugins are loaded by default . The redhat.repo file was populated and repos were listed in the output

rhsm.log
==========

2018-08-20 05:38:00,285 [INFO] dnf:16096:MainThread @connection.py:871 - Connection built: host=subscription.rhsm.stage.redhat.com port=443 handler=/subscription auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=False
2018-08-20 05:38:00,308 [INFO] dnf:16096:MainThread @connection.py:871 - Connection built: host=subscription.rhsm.stage.redhat.com port=443 handler=/subscription auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=False
2018-08-20 05:38:00,310 [DEBUG] dnf:16096:MainThread @connection.py:497 - Loaded CA certificates from /etc/rhsm/ca/: redhat-uep.pem
2018-08-20 05:38:00,310 [DEBUG] dnf:16096:MainThread @connection.py:545 - Making request: GET /subscription/
2018-08-20 05:38:00,656 [INFO] dnf:16096:MainThread @connection.py:588 - Response: status=200, request="GET /subscription/"
2018-08-20 05:38:00,656 [DEBUG] dnf:16096:MainThread @connection.py:888 - Server supports the following resources: {u'': u'/', u'guestids': u'/consumers/{consumer_uuid}/guestids', u'cdn': u'/cdn', u'content_overrides': u'/consumers/{consumer_uuid}/content_overrides', u'hypervisors': u'/hypervisors', u'serials': u'/serials', u'deleted_consumers': u'/deleted_consumers', u'consumers': u'/consumers', u'migrations': u'/migrations', u'content': u'/content', u'entitlements': u'/entitlements', u'events': u'/events', u'status': u'/status', u'jobs': u'/jobs', u'users': u'/users', u'subscriptions': u'/subscriptions', u'rules': u'/rules', u'distributor_versions': u'/distributor_versions', u'consumertypes': u'/consumertypes', u'statistics/generate': u'/statistics/generate', u'pools': u'/pools', u'atom': u'/atom', u'packages': u'/consumers/{consumer_uuid}/packages', u'owners': u'/owners', u'roles': u'/roles', u'admin': u'/admin', u'products': u'/products', u'activation_keys': u'/activation_keys', u'crl': u'/crl'}
2018-08-20 05:38:00,830 [DEBUG] dnf:16096:MainThread @__init__.py:92 - Searching for content of type: yum
2018-08-20 05:38:00,832 [DEBUG] dnf:16096:MainThread @connection.py:497 - Loaded CA certificates from /etc/rhsm/ca/: redhat-uep.pem
2018-08-20 05:38:00,833 [DEBUG] dnf:16096:MainThread @connection.py:545 - Making request: GET /subscription/consumers/2dd800bd-4346-4cff-83d4-9714618696b6/release
2018-08-20 05:38:01,347 [INFO] dnf:16096:MainThread @connection.py:588 - Response: status=200, requestUuid=b4851e0c-094d-43d0-95b8-eddf2d6df74b, request="GET /subscription/consumers/2dd800bd-4346-4cff-83d4-9714618696b6/release"
2018-08-20 05:38:01,348 [DEBUG] dnf:16096:MainThread @cache.py:302 - Started thread to write cache: /var/lib/rhsm/cache/releasever.json
2018-08-20 05:38:01,395 [DEBUG] dnf:16096:WriteCacheReleaseStatusCacheThread @cache.py:114 - Wrote cache: /var/lib/rhsm/cache/releasever.json
2018-08-20 05:38:02,341 [DEBUG] dnf:16096:MainThread @cache.py:114 - Wrote cache: /var/lib/rhsm/cache/written_overrides.json
2018-08-20 05:38:02,342 [INFO] dnf:16096:MainThread @repolib.py:481 - repos updated: Repo updates

Total repo updates: 142
Updated
    [id:rhel-7-server-dotnet-debug-rpms dotNET on RHEL Debug RPMs for Red Hat Enterprise Linux 7 Server]
    [id:rhel-7-server-satellite-tools-6.2-rpms Red Hat Satellite Tools 6.2 (for RHEL 7 Server) (RPMs)]
    [id:rhel-7-server-v2vwin-1-debug-rpms Red Hat Virt V2V Tool for RHEL 7 (Debug RPMs)]
    [id:rhel-7-server-insights-3-debug-rpms Red Hat Insights 3 (for RHEL 7 Server) (Debug RPMs)]
    [id:rhel-7-server-satellite-maintenance-6-beta-debug-rpms Red Hat Satellite Maintenance 6 Beta (for RHEL 7 Server) (Debug RPMs)]
    [id:rhel-7-server-ansible-2-rpms Red Hat Ansible Engine 2 RPMs for Red Hat Enterprise Linux 7 Server]
    [id:rhel-7-server-openstack-11-tools-debug-rpms Red Hat OpenStack Platform 11 Tools for RHEL 7 Server (Debug RPMs)]
    [id:rhel-server-rhscl-7-eus-source-rpms Red Hat Software Collections Source RPMs for Red Hat Enterprise Linux 7 RHEL 7 Server EUS]
    [id:rhel-7-server-rhceph-2-tools-rpms Red Hat Ceph Storage Tools 2 for Red Hat Enterprise Linux 7 Server (RPMs)]
    [id:rhel-7-server-devtools-beta-source-rpms Red Hat Developer Tools Beta Source RPMs for Red Hat Enterprise Linux 7 Server]
    [id:rhel-7-server-extras-rpms Red Hat Enterprise Linux 7 Server - Extras (RPMs)]
<snip>

Based on the above observations , Marking the bug as "Verified"

Comment 6 errata-xmlrpc 2018-10-30 10:37:37 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:3153