Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1390341 - rhn-migrate-classic-to-rhsm is failing to stop and disable services
rhn-migrate-classic-to-rhsm is failing to stop and disable services
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager (Show other bugs)
6.9
Unspecified Unspecified
high Severity medium
: rc
: ---
Assigned To: Kevin Howell
John Sefler
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-10-31 14:17 EDT by John Sefler
Modified: 2017-03-21 06:56 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-03-21 06:56:42 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Github candlepin/subscription-manager/pull/1516 None None None 2016-11-08 15:05 EST
Red Hat Product Errata RHSA-2017:0698 normal SHIPPED_LIVE Moderate: subscription-manager security, bug fix, and enhancement update 2017-03-21 08:39:12 EDT

  None (edit)
Description John Sefler 2016-10-31 14:17:11 EDT
Description of problem:
Newly introduced by RFE Bug 1185914 is an automatic feature that stops and disables services [osad,rhnsd].  Unfortunately it appears to stop and disable services a little too aggressively which throws errors in the output...  See reproducer.

I'd propose that the logic be changed for stopping and disabling services to pseudo code like this...

for each package p in [osad,rhnsd] {
    if package $p is installed, then {
        if service $p is running, then {
            service $p stop
        }
        chkconfig $p off
    }
}


Version-Release number of selected component (if applicable):
[root@jsefler-rhel6 ~]# rpm -q subscription-manager-migration
subscription-manager-migration-1.18.3-1.el6.x86_64


How reproducible:


Steps to Reproduce:
[root@jsefler-rhel6 ~]# rhnreg_ks --serverUrl=https://rhsm-sat5.usersys.redhat.com/XMLRPC --username=rhsm-client --password=password --profilename=rhsm-automation.jsefler-rhel6.usersys.redhat.com --force --norhnsd --nohardware --nopackages --novirtinfo
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# service osad status
osad is stopped
[root@jsefler-rhel6 ~]# service rhnsd status
rhnsd is stopped
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# chkconfig --list osad
osad           	0:off	1:off	2:on	3:on	4:on	5:on	6:off
[root@jsefler-rhel6 ~]# chkconfig --list rhnsd
rhnsd          	0:off	1:off	2:on	3:on	4:on	5:on	6:off
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# rhn-migrate-classic-to-rhsm
Legacy username: rhsm-client
Legacy password: 
Destination username: testuser1 
Destination password: 
Org: admin

Retrieving existing legacy subscription information...

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

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

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...
Shutting down osad:                                        [FAILED]
Usage: /etc/init.d/osad {start|stop|restart|reload|status|condrestart}

Attempting to register system to destination server...
Registering to: jsefler-candlepin.usersys.redhat.com:8443/candlepin
The system has been registered with ID: bc1ab642-89f3-4f33-97c3-c791bed03796 

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

Unable to find available subscriptions for all your installed products.
System 'jsefler-rhel6.usersys.redhat.com' successfully registered.

[root@jsefler-rhel6 ~]# 



Actual results:
Stopping and disabling legacy services...
Shutting down osad:                                        [FAILED]
Usage: /etc/init.d/osad {start|stop|restart|reload|status|condrestart}


Expected results:
In this case since the service was already stopped, there would not have been any feedback in the rhn-migrate-classic-to-rhsm output.
Then the call to 'chkconfig osad off' would pass (also with no output)
Moreover, I think the current implementation is calling 'service osad disable' instead of 'chkconfig osad off'
[root@jsefler-rhel6 ~]# service osad disable
Usage: /etc/init.d/osad {start|stop|restart|reload|status|condrestart}


Additional info:
Comment 1 John Sefler 2016-10-31 14:28:03 EDT
Note: In the current implementation, if one of the packages is not installed, you'll get questionable feedback like this:

Preparing to unregister system from legacy server...
System successfully unregistered from legacy server.
Stopping and disabling legacy services...
osad: unrecognized service
osad: unrecognized service


Using the proposed logic in comment 0, you'll avoid the "unrecognized service".
Comment 4 Chris Snyder 2016-11-16 14:10:00 EST
Fixed upstream. Moving to POST.
Comment 6 John Sefler 2016-12-13 15:43:44 EST
Verifying Version...
[root@jsefler-rhel6 ~]# rpm -q subscription-manager-migration
subscription-manager-migration-1.18.6-1.el6.x86_64

With these classic packages installed...
[root@jsefler-rhel6 ~]# rpm -q osad rhnsd
osad-5.11.44-5.el6sat.noarch
rhnsd-4.9.3-5.el6.x86_64

[root@jsefler-rhel6 ~]# rhnreg_ks --serverUrl=https://rhsm-sat5.usersys.redhat.com/XMLRPC --username=rhsm-client --password=password --profilename=rhsm-automation.jsefler-rhel6.usersys.redhat.com --force --norhnsd --nohardware --nopackages --novirtinfo
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# service osad status
osad is stopped
[root@jsefler-rhel6 ~]# service rhnsd status
rhnsd (pid  13167) is running...
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# chkconfig --list osad
osad           	0:off	1:off	2:on	3:on	4:on	5:on	6:off
[root@jsefler-rhel6 ~]# chkconfig --list rhnsd
rhnsd          	0:off	1:off	2:on	3:on	4:on	5:on	6:off
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# rhn-migrate-classic-to-rhsm --destination-url=subscription.rhsm.stage.redhat.com:443/subscription
Legacy username: rhsm-client
Legacy password: 
Destination username: qa@redhat.com
Destination password: 

Retrieving existing legacy subscription information...

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

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

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...

Attempting to register system to destination server...
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
The system has been registered with ID: f8e50646-e66f-40c7-ae18-32f4ecbd1e20 

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

System 'jsefler-rhel6.usersys.redhat.com' successfully registered.

[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# chkconfig --list rhnsd
rhnsd          	0:off	1:off	2:off	3:off	4:off	5:off	6:off
[root@jsefler-rhel6 ~]# chkconfig --list osad
osad           	0:off	1:off	2:off	3:off	4:off	5:off	6:off
[root@jsefler-rhel6 ~]# 

VERIFIED:  a FAILURE is no longer encountered when "Stopping and disabling legacy services".  In fact, both the chkconfig of rhnsd and osad were disabled after the migration was completed.


--------------------------------------------------------

Let's verify again without one of the classic packages installed (let's remove osad and verify rhn-migrate-classic-to-rhsm is successful)... 


[root@jsefler-rhel6 ~]# subscription-manager unregister 
System has been unregistered.
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# yum remove --quiet --assumeyes osad
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# chkconfig rhnsd on
[root@jsefler-rhel6 ~]# chkconfig --list rhnsd
rhnsd          	0:off	1:off	2:on	3:on	4:on	5:on	6:off
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# rhnreg_ks --serverUrl=https://rhsm-sat5.usersys.redhat.com/XMLRPC --username=rhsm-client --password=password --profilename=rhsm-automation.jsefler-rhel6.usersys.redhat.com --force --norhnsd --nohardware --nopackages --novirtinfo
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# service osad status
osad: unrecognized service
[root@jsefler-rhel6 ~]# service rhnsd status
rhnsd (pid  13167) is running...
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# chkconfig --list osad
error reading information on service osad: No such file or directory
[root@jsefler-rhel6 ~]# chkconfig --list rhnsd
rhnsd          	0:off	1:off	2:on	3:on	4:on	5:on	6:off
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# rhn-migrate-classic-to-rhsm --destination-url=subscription.rhsm.stage.redhat.com:443/subscription
Legacy username: rhsm-client
Legacy password: 
Destination username: qa@redhat.com
Destination password: 

Retrieving existing legacy subscription information...

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

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

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...

Attempting to register system to destination server...
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
The system has been registered with ID: 0ca601ae-a3ad-41ee-aa50-88378a8612d7 

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

System 'jsefler-rhel6.usersys.redhat.com' successfully registered.

[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# chkconfig --list osad
error reading information on service osad: No such file or directory
[root@jsefler-rhel6 ~]# chkconfig --list rhnsd
rhnsd          	0:off	1:off	2:off	3:off	4:off	5:off	6:off
[root@jsefler-rhel6 ~]# 


VERIFIED: Even with one of the classic packages (osad) not installed, rhn-migrate-classic-to-rhsm was graceful "Stopping and disabling legacy services...".  No FAILURES encountered.
Comment 8 errata-xmlrpc 2017-03-21 06:56:42 EDT
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://rhn.redhat.com/errata/RHSA-2017-0698.html

Note You need to log in before you can comment on or make changes to this bug.