Bug 843999

Summary: subscription-manager repos --list throws traceback when not registered
Product: Red Hat Enterprise Linux 5 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: William Poteat <wpoteat>
Status: CLOSED DUPLICATE QA Contact: Entitlement Bugs <entitlement-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 5.9Keywords: Regression
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-07-27 19:59:31 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: 771748    

Description John Sefler 2012-07-27 19:22:09 UTC
Description of problem:
A call to subscription-manager repos [--list] throws a traceback when not registered.  This is a regression from rhel58.


Version-Release number of selected component (if applicable):
[root@jsefler-rhel59 ~]# rpm -q subscription-manager
subscription-manager-1.0.11-1.git.2.d2c02ce.el5


How reproducible:


Steps to Reproduce:
[root@jsefler-rhel59 ~]# subscription-manager unregister
This system is currently not registered.
[root@jsefler-rhel59 ~]# subscription-manager repos

[Errno 2] No such file or directory: '/etc/pki/consumer/key.pem'
[root@jsefler-rhel59 ~]# subscription-manager repos --list

[Errno 2] No such file or directory: '/etc/pki/consumer/key.pem'
[root@jsefler-rhel59 ~]# 

  
Actual results:
above

Expected results:
The system is not entitled to use any repositories.

Additional info:
[root@jsefler-rhel59 ~]# tail -f /var/log/rhsm/rhsm.log
2012-07-27 15:19:51,659 [INFO]  @connection.py:492 - Using certificate authentication: key = /etc/pki/consumer/key.pem, cert = /etc/pki/consumer/cert.pem, ca = /etc/rhsm/ca/, insecure = False
2012-07-27 15:19:51,659 [INFO]  @connection.py:505 - Connection Built: host: jsefler-f14-candlepin.usersys.redhat.com, port: 8443, handler: /candlepin
2012-07-27 15:19:51,659 [DEBUG]  @profile.py:95 - Loading current RPM profile.
2012-07-27 15:19:51,879 [DEBUG]  @connection.py:317 - Loading CA PEM certificates from: /etc/rhsm/ca/
2012-07-27 15:19:51,880 [DEBUG]  @connection.py:299 - Loading CA certificate: '/etc/rhsm/ca/redhat-uep.pem'
2012-07-27 15:19:51,880 [DEBUG]  @connection.py:299 - Loading CA certificate: '/etc/rhsm/ca/jsefler-f14-candlepin.pem'
2012-07-27 15:19:51,880 [DEBUG]  @connection.py:299 - Loading CA certificate: '/etc/rhsm/ca/candlepin-stage.pem'
2012-07-27 15:19:51,983 [DEBUG]  @managercli.py:397 - Versions: {'subscription manager': '1.0.11-1.git.2.d2c02ce.el5', 'server-type': 'subscription management service', 'python-rhsm': '1.0.4-1.git.4.c4ed5bf.el5', 'candlepin': 'Unknown'} 
2012-07-27 15:19:52,129 [DEBUG]  @cert_sorter.py:106 - Sorting product and entitlement cert status for: 2012-07-27 19:19:52.129546+00:00
2012-07-27 15:19:52,167 [DEBUG]  @cert_sorter.py:160 - Installed product IDs: ['100000000000006', '1000000000000023', '1144', '100000000000011', '100000000000010', '100000000000013', '100000000000012', '100000000000015', '99000', '27060', '69', '37090', '1', '37069', '37068', '37080', '37065', '37067', '37060', '37062', '100000000000060', '100000000000007', '100000000000004', '100000000000005', '100000000000002', '100000000000003', '100000000000000', '100000000000001', '100000000000020', '100000000000022', '100000000000009', '100000000000008', '88888', '917571', '37070']
2012-07-27 15:19:52,168 [DEBUG]  @cert_sorter.py:113 - valid entitled products: []
2012-07-27 15:19:52,168 [DEBUG]  @cert_sorter.py:114 - expired entitled products: []
2012-07-27 15:19:52,168 [DEBUG]  @cert_sorter.py:115 - partially entitled products: []
2012-07-27 15:19:52,169 [DEBUG]  @cert_sorter.py:116 - unentitled products: ['100000000000060', '1000000000000023', '1144', '100000000000011', '100000000000010', '100000000000013', '100000000000012', '100000000000015', '99000', '27060', '69', '917571', '1', '37069', '37068', '37080', '37065', '37067', '37060', '37062', '100000000000006', '100000000000007', '100000000000004', '100000000000005', '100000000000002', '100000000000003', '100000000000000', '100000000000001', '100000000000020', '100000000000022', '100000000000009', '100000000000008', '88888', '37090', '37070']
2012-07-27 15:19:52,169 [DEBUG]  @cert_sorter.py:117 - future products: []
2012-07-27 15:19:52,169 [DEBUG]  @cert_sorter.py:118 - partial stacks: []
2012-07-27 15:19:52,169 [DEBUG]  @cert_sorter.py:119 - valid stacks: []
2012-07-27 15:19:52,171 [ERROR]  @certlib.py:257 - [Errno 2] No such file or directory: '/etc/pki/consumer/key.pem'
2012-07-27 15:19:52,172 [ERROR]  @managercli.py:114 - exception caught in subscription-manager
2012-07-27 15:19:52,172 [ERROR]  @managercli.py:115 - [Errno 2] No such file or directory: '/etc/pki/consumer/key.pem'
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 78, in ?
    sys.exit(abs(main() or 0))
  File "/usr/sbin/subscription-manager", line 69, in main
    return managercli.CLI().main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 1957, in main
    return cmd.main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 401, in main
    return_code = self._do_command()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 1484, in _do_command
    certmgr.update()
  File "/usr/share/rhsm/subscription_manager/certmgr.py", line 85, in update
    updates += lib.update()
  File "/usr/share/rhsm/subscription_manager/certlib.py", line 61, in update
    return self._do_update()
  File "/usr/share/rhsm/subscription_manager/certlib.py", line 167, in _do_update
    idcert = ConsumerIdentity.read()
  File "/usr/share/rhsm/subscription_manager/certlib.py", line 346, in read
    f = open(cls.keypath())
IOError: [Errno 2] No such file or directory: '/etc/pki/consumer/key.pem'

Comment 1 RHEL Program Management 2012-07-27 19:28:20 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 3 John Sefler 2012-07-27 19:59:31 UTC

*** This bug has been marked as a duplicate of bug 837447 ***