Bug 1466453

Summary: [RFE] rhn-migrate-classic-to-rhsm should ensure subscription-manager yum plugin is enabled
Product: Red Hat Enterprise Linux 7 Reporter: Mason Loring Bliss <mbliss>
Component: subscription-managerAssignee: Jiri Hnidek <jhnidek>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: high Docs Contact: Filip Hanzelka <fhanzelk>
Priority: high    
Version: 7.3CC: bcourt, cdonnell, csnyder, cww, jhnidek, kdixon, khowell, mbliss, redakkan, rjerrido, skallesh
Target Milestone: rcKeywords: FutureFeature, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: subscription-manager-1.20.2-1 Doc Type: Release Note
Doc Text:
*rhn-migrate-classic-to-rhsm* now automatically enables the `subscription-manager` and `product-id` yum plugins With this update, the *rhn-migrate-classic-to-rhsm* utility automatically enables the `yum` plugins: `subscription-manager` and `product-id`. With this update, the *subscription-manager* utility automatically enables the `yum` plugins: `subscription-manager` and `product-id`. This update benefits users of Red Hat Enterprise Linux who previously used the *rhn-client-tools* utility to register their systems to Red Hat Network Classic or who still use it with Satellite 5 entitlement servers, and who have temporarily disabled the `yum` plugins. As a result, *rhn-migrate-classic-to-rhsm* allows an easy transition to using the newer *subscription-manager* tools for entitlements. Note that running *rhn-migrate-classic-to-rhsm* displays a warning message indicating how to change this default behavior if it is not desirable.
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 09:49:52 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: 1516832    
Bug Blocks: 1420851, 1469152    

Description Mason Loring Bliss 2017-06-29 16:15:23 UTC
Description of problem:


Version-Release number of selected component (if applicable):

Presumably all versions.


How reproducible:


Steps to Reproduce:
1. Register a system with RHN.
2. Install subscription manager, disable /etc/yum/pluginconf.d/subscription-manager.conf
3. Run rhn-migrate-classic-to-rhsm

Actual results:

/etc/yum/pluginconf.d/subscription-manager.conf left disabled

Expected results:

/etc/yum/pluginconf.d/subscription-manager.conf enabled

Additional info:

Unclear how the setting was disabled, but SFDC case 01865488 saw my customer encounter this.

Comment 10 Rehana 2017-11-13 11:56:01 UTC
Reproducing the failure on RHEL74:
====================================

version:
subscription management server: 2.0.43-1
subscription management rules: 5.26
subscription-manager: 1.19.21-1.el7
python-rhsm: 1.19.9-1.el7

1)REgister system with RHN 

#  rhnreg_ks --serverUrl=https://rhsm-sat5.usersys.redhat.com/XMLRPC --username=rhsm-client --password=**** --profilename=rhsmtest --force  --nohardware --nopackages --novirtinfo

2)Disabled the subscription-manager and product-id plugins 

#sed -i s/^enabled=1/enabled=0/ /etc/yum/pluginconf.d/subscription-manager.conf

#sed -i s/^enabled=1/enabled=0/ /etc/yum/pluginconf.d/product-id.conf

Verifying the same is set to "0"

#egrep ^enabled /etc/yum/pluginconf.d/product-id.conf
enabled=0
# egrep ^enabled /etc/yum/pluginconf.d/subscription-manager.conf
enabled=0

3) Now migrate the system to RHSM


[root@dhcp35-85 ~]#  rhn-migrate-classic-to-rhsm --legacy-user=rhsm-client --legacy-password=*** --destination-url=subscription.rhsm.stage.redhat.com:443/subscription --destination-user=qa --destination-password=***

Retrieving existing legacy subscription information...

+-----------------------------------------------------+
System is currently subscribed to these legacy channels:
+-----------------------------------------------------+
rhel-x86_64-server-7

+-----------------------------------------------------+
Installing product certificates for these legacy channels:
+-----------------------------------------------------+
rhel-x86_64-server-7

Product certificates installed successfully to /etc/pki/product.

Preparing to unregister system from legacy server...
System successfully unregistered from legacy server.
Stopping and disabling legacy services...
rhnsd.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig rhnsd off

Attempting to register system to destination server...
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
The system has been registered with ID: 6f0add1f-9fa5-4de9-af68-d61204fad2e7 

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

System 'dhcp35-85.lab.eng.blr.redhat.com' successfully registered.

Verify if the plugins are enabled.

# egrep ^enabled /etc/yum/pluginconf.d/subscription-manager.conf
enabled=0
# egrep ^enabled /etc/yum/pluginconf.d/product-id.conf
enabled=0
[root@dhcp35-85 pluginconf.d]# 

Observed that the "subscription-manager" and product-id plugins were not enabled
also see the yum repolist didn't load those plugins 

[root@dhcp35-85 ~]# yum repolist
Loaded plugins: langpacks, search-disabled-repos
repo id        repo name                    status
!rhel-7-server-rpms/7Server/x86_64                                                                 Red Hat Enterprise Linux 7 Server (RPMs)                                                                  17,474
repolist: 17,474

Comment 11 Rehana 2017-11-27 13:31:33 UTC
Verification is blocked until bug 1516832 is fixed

Comment 12 Shwetha Kallesh 2017-12-11 08:57:22 UTC
Moving bug to verified as yum plugin is enabled when migrated from rhn to rhsm

[root@dhcp35-7 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 2.0.43-1
subscription management rules: 5.26
subscription-manager: 1.20.7-1.el7


[root@dhcp35-7 ~]# rhnreg_ks --serverUrl=https://rhsm-sat5.usersys.redhat.com/XMLRPC --username=**** --password=**** --profilename=rhsmtest --force  --nohardware --nopackages --novirtinfo
[root@dhcp35-7 ~]# subscription-manager identity
server type: RHN Classic

WARNING

The yum plugins: /etc/yum/pluginconf.d/subscription-manager.conf, /etc/yum/pluginconf.d/product-id.conf were automatically enabled for the benefit of Red Hat Subscription Management. If not desired, use "subscription-manager config --rhsm.auto_enable_yum_plugins=0" to block this behavior.

[root@dhcp35-7 ~]# sed -i s/^enabled=1/enabled=0/ /etc/yum/pluginconf.d/subscription-manager.conf
[root@dhcp35-7 ~]# sed -i s/^enabled=1/enabled=0/ /etc/yum/pluginconf.d/product-id.conf
[root@dhcp35-7 ~]# 
[root@dhcp35-7 ~]# egrep ^enabled /etc/yum/pluginconf.d/product-id.conf
enabled=0
[root@dhcp35-7 ~]# egrep ^enabled /etc/yum/pluginconf.d/subscription-manager.conf
enabled=0


[root@dhcp35-7 ~]#  rhn-migrate-classic-to-rhsm --legacy-user=**** --legacy-password=**** --destination-url=subscription.rhsm.stage.redhat.com:443/subscription --destination-user=shwetha_tier1_test --destination-password=***

Retrieving existing legacy subscription information...

+-----------------------------------------------------+
System is currently subscribed to these legacy channels:
+-----------------------------------------------------+
rhel-x86_64-server-7

+-----------------------------------------------------+
Installing product certificates for these legacy channels:
+-----------------------------------------------------+
rhel-x86_64-server-7

Product certificates installed successfully to /etc/pki/product.

Preparing to unregister system from legacy server...
System successfully unregistered from legacy server.
Stopping and disabling legacy services...
rhnsd.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig rhnsd off

Attempting to register system to destination server...
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
The system has been registered with ID: 1ca2a68e-0c84-4173-8c0f-4b1cfe31053d
The registered system name is: dhcp35-7.lab.eng.blr.redhat.com
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed


WARNING

The yum plugins: /etc/yum/pluginconf.d/subscription-manager.conf, /etc/yum/pluginconf.d/product-id.conf were automatically enabled for the benefit of Red Hat Subscription Management. If not desired, use "subscription-manager config --rhsm.auto_enable_yum_plugins=0" to block this behavior.

System 'dhcp35-7.lab.eng.blr.redhat.com' successfully registered.

[root@dhcp35-7 ~]# egrep ^enabled /etc/yum/pluginconf.d/product-id.conf
enabled=1

[root@dhcp35-7 ~]# egrep ^enabled /etc/yum/pluginconf.d/subscription-manager.conf
enabled=1

Comment 17 errata-xmlrpc 2018-04-10 09:49:52 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:0681