Bug 816377

Summary: rhn-migrate-classic-to-rhsm throws traceback when subscription-manager-migration-data is not installed
Product: Red Hat Enterprise Linux 6 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Adrian Likins <alikins>
Status: CLOSED ERRATA QA Contact: Entitlement Bugs <entitlement-bugs>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.3CC: alikins, awood
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 12:56:51 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: 738066    

Description John Sefler 2012-04-25 22:24:03 UTC
Description of problem:
Running rhn-migrate-classic-to-rhsm without subscription-manager-migration-data installed, a traceback is thrown.

Version-Release number of selected component (if applicable):
subscription-manager-migration-0.99.14-1.el6.x86_64


How reproducible:


Steps to Reproduce:
[root@jsefler-r63-server ~]# rpm -q subscription-manager-migration-data
package subscription-manager-migration-data is not installed
[root@jsefler-r63-server ~]# 
[root@jsefler-r63-server ~]# rhnreg_ks --serverUrl=https://xmlrpc.rhn.code.stage.redhat.com/XMLRPC --username=qa --password=****** --profilename=jsefler-r63-server --force --norhnsd --nohardware --nopackages --novirtinfo
[root@jsefler-r63-server ~]# rhn-migrate-classic-to-rhsm 
RHN Username: qa
Password: 

Retrieving existing RHN Classic subscription information ...
+----------------------------------+
System is currently subscribed to:
+----------------------------------+
rhel-x86_64-server-6
Traceback (most recent call last):
  File "/usr/sbin/rhn-migrate-classic-to-rhsm", line 477, in <module>
    main()
  File "/usr/sbin/rhn-migrate-classic-to-rhsm", line 461, in main
    deployProdCertificates(subscribedChannels)
  File "/usr/sbin/rhn-migrate-classic-to-rhsm", line 310, in deployProdCertificates
    dic_data = readChannelCertMapping()
  File "/usr/sbin/rhn-migrate-classic-to-rhsm", line 253, in readChannelCertMapping
    f = open(mappingfile)
IOError: [Errno 2] No such file or directory: '/usr/share/rhsm/product/RHEL-6/channel-cert-mapping.txt'
[root@jsefler-r63-server ~]# echo $?
1
 
Expected a more graceful message to the user.  For example:
Could not find required '/usr/share/rhsm/product/RHEL-6/channel-cert-mapping.txt'.  Verify that the subscription-manager-migration-data package is installed.

Additional info:

Comment 2 Adrian Likins 2012-04-26 19:21:18 UTC
commit 8ad990501db2491e9031602cc8130522ebb29c09
Author: Adrian Likins <alikins>
Date:   Thu Apr 26 14:11:28 2012 -0400

    816377: handle cert migration data being missing

Comment 5 John Sefler 2012-05-03 22:22:43 UTC
Verifying Version...
[root@bigisis ~]# rpm -q subscription-manager-migration
subscription-manager-migration-0.99.16-1.el6.x86_64
[root@bigisis ~]# rpm -q subscription-manager-migration-data
package subscription-manager-migration-data is not installed


[root@bigisis ~]# rhnreg_ks --serverUrl=https://xmlrpc.rhn.code.stage.redhat.com/XMLRPC --username=qa --password=redhatqa --profilename=bigisis --force --norhnsd --nohardware --nopackages --novirtinfo
[root@bigisis ~]# rhn-migrate-classic-to-rhsm
RHN Username: qa
Password: 

Retrieving existing RHN Classic subscription information ...
+----------------------------------+
System is currently subscribed to:
+----------------------------------+
rhel-x86_64-server-6
Unable to connect to certificate server: [Errno 2] No such file or directory: '/usr/share/rhsm/product/RHEL-6/channel-cert-mapping.txt'.  See /var/log/rhsm/rhsm.log for more details.
[root@bigisis ~]# echo $?
1



[root@bigisis ~]# tail /var/log/rhsm/rhsm.log
2012-05-03 17:39:31,492 [DEBUG]  @connection.py:329 - Making request: GET /subscription/users/qa%40redhat.com/owners
2012-05-03 17:39:35,522 [DEBUG]  @connection.py:343 - Response status: 200
2012-05-03 17:39:36,852 [INFO]  @rhn-migrate-classic-to-rhsm:252 - Using mapping file /usr/share/rhsm/product/RHEL-6/channel-cert-mapping.txt
2012-05-03 17:39:36,852 [ERROR]  @rhn-migrate-classic-to-rhsm:313 - [Errno 2] No such file or directory: '/usr/share/rhsm/product/RHEL-6/channel-cert-mapping.txt'
Traceback (most recent call last):
  File "/usr/sbin/rhn-migrate-classic-to-rhsm", line 311, in deployProdCertificates
    dic_data = readChannelCertMapping()
  File "/usr/sbin/rhn-migrate-classic-to-rhsm", line 253, in readChannelCertMapping
    f = open(mappingfile)
IOError: [Errno 2] No such file or directory: '/usr/share/rhsm/product/RHEL-6/channel-cert-mapping.txt'
[root@bigisis ~]# 


^^^ WELL... The original traceback is now caught and logged.  The user still doesn't know what to do.  I guess it's time for the user to read the man page. 

[root@bigisis ~]# man -P cat rhn-migrate-classic-to-rhsm | grep data
[root@bigisis ~]# 

Sorry, there is no reference to "data" in the man page for rhn-migrate-classic-to-rhsm

Moving this bug to VERIFIED and opening separate bug 818767 requesting additional info to the man page.

Comment 7 errata-xmlrpc 2012-06-20 12:56:51 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.

http://rhn.redhat.com/errata/RHBA-2012-0804.html