Bug 979492 - certlib.py:359 - [Errno 2] No such file or directory: '/etc/pki/entitlement/8708055077508634943-key.pem'
certlib.py:359 - [Errno 2] No such file or directory: '/etc/pki/entitlement/...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: subscription-manager (Show other bugs)
5.10
Unspecified Unspecified
unspecified Severity high
: rc
: ---
Assigned To: Carter Kozak
IDM QE LIST
: Regression
Depends On:
Blocks: rhsm-rhel510
  Show dependency treegraph
 
Reported: 2013-06-28 12:37 EDT by John Sefler
Modified: 2014-09-14 20:08 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-10-01 09:50:01 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)

  None (edit)
Description John Sefler 2013-06-28 12:37:40 EDT
Description of problem:
It appears that when a system is registered and consuming entitlements and the a new registration with force coupled with a simultaneous bind (via autosubscribe or an activationkey), the new entitlements do not get attached.  Instead there is a Traceback in rhsm.log from certlib.py:359 -  [Errno 2] No such file or directory.  This is causing many automated test regressions.

Version-Release number of selected component (if applicable):
[root@jsefler-5server ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.8.15-1
subscription-manager: 1.8.11-1.git.27.98ba029.el5
python-rhsm: 1.8.13-1.git.0.85d7af5.el5


How reproducible:


Steps to Reproduce:
Using the TESTDATA with only product 100000000000002.pem installed for simplicity....

[root@jsefler-5server ~]# subscription-manager unregister
System has been unregistered.
[root@jsefler-5server ~]# subscription-manager register --username=testuser1 --org=admin --auto-attach
Password: 
The system has been registered with ID: a018bf4d-12fe-4742-8da3-0263d1fd8aa4 
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Not Subscribed

Product Name: Awesome OS for x86_64 Bits
Status:       Subscribed

[root@jsefler-5server ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS for x86_64
Provides:          Awesome OS for x86_64 Bits
SKU:               awesomeos-x86_64
Contract:          79
Account:           12331131231
Serial:            2486060809078526881
Pool ID:           8a90f81a3f8b43c5013f8b45432d059d
Active:            True
Quantity Used:     2
Service Level:     
Service Type:      
Status Details:    
Starts:            06/27/2013
Ends:              06/27/2014

[root@jsefler-5server ~]# subscription-manager register --username=testuser1 --org=admin --auto-attach --force
The system with UUID a018bf4d-12fe-4742-8da3-0263d1fd8aa4 has been unregistered
Password: 
The system has been registered with ID: b7fd9c23-909b-4b9e-99dc-d93b95f5148a 
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Not Subscribed

Product Name: Awesome OS for x86_64 Bits
Status:       Subscribed

[root@jsefler-5server ~]# subscription-manager list --consumed
No consumed subscription pools to list

^^^^ That's not correct. we should be consuming a new entitlement from the same subscription that we were given during the prior registration.  The second register with force coupled with a subscription bind seems to be throwing a traceback in rhsm.log




[root@jsefler-5server ~]# tail -f /var/log/rhsm/rhsm.log

2013-06-28 12:24:36,856 [DEBUG]  @injection.py:79 - Returning instance for feature ENT_DIR
2013-06-28 12:24:36,857 [DEBUG]  @connection.py:394 - Loading CA PEM certificates from: /etc/rhsm/ca/
2013-06-28 12:24:36,857 [DEBUG]  @connection.py:376 - Loading CA certificate: '/etc/rhsm/ca/jsefler-f14-5candlepin.pem'
2013-06-28 12:24:36,858 [DEBUG]  @connection.py:376 - Loading CA certificate: '/etc/rhsm/ca/redhat-uep.pem'
2013-06-28 12:24:36,858 [DEBUG]  @connection.py:376 - Loading CA certificate: '/etc/rhsm/ca/candlepin-stage.pem'
2013-06-28 12:24:36,859 [DEBUG]  @connection.py:415 - Making request: GET /candlepin/consumers/b7fd9c23-909b-4b9e-99dc-d93b95f5148a/certificates/serials
2013-06-28 12:24:36,983 [DEBUG]  @connection.py:434 - Response status: 200
2013-06-28 12:24:36,986 [DEBUG]  @injection.py:79 - Returning instance for feature ENT_DIR
2013-06-28 12:24:36,989 [DEBUG]  @connection.py:394 - Loading CA PEM certificates from: /etc/rhsm/ca/
2013-06-28 12:24:36,990 [DEBUG]  @connection.py:376 - Loading CA certificate: '/etc/rhsm/ca/jsefler-f14-5candlepin.pem'
2013-06-28 12:24:36,990 [DEBUG]  @connection.py:376 - Loading CA certificate: '/etc/rhsm/ca/redhat-uep.pem'
2013-06-28 12:24:36,991 [DEBUG]  @connection.py:376 - Loading CA certificate: '/etc/rhsm/ca/candlepin-stage.pem'
2013-06-28 12:24:36,991 [DEBUG]  @connection.py:415 - Making request: GET /candlepin/consumers/b7fd9c23-909b-4b9e-99dc-d93b95f5148a/certificates?serials=301560389077337403
2013-06-28 12:24:37,115 [DEBUG]  @connection.py:434 - Response status: 200
2013-06-28 12:24:37,120 [ERROR]  @certlib.py:359 - [Errno 2] No such file or directory: '/etc/pki/entitlement/301560389077337403-key.pem'
Traceback (most recent call last):
  File "/usr/share/rhsm/subscription_manager/certlib.py", line 356, in install
    br.write(key, cert)
  File "/usr/share/rhsm/subscription_manager/certdirectory.py", line 289, in write
    key.write(key_path)
  File "/usr/lib64/python2.4/site-packages/rhsm/certificate.py", line 574, in write
    f = open(pem_path, 'w')
IOError: [Errno 2] No such file or directory: '/etc/pki/entitlement/301560389077337403-key.pem'
2013-06-28 12:24:37,121 [ERROR]  @certlib.py:363 - Bundle not loaded:
{'updated': '2013-06-28T16:24:36.732+0000', 'created': '2013-06-28T16:24:36.732+0000', 'cert': '-----BEGIN CERTIFICATE-----\nMIID1jCCAz+gAwIBAgIIBC9bk31IhTswDQYJKoZIhvcNAQEFBQAwUzEyMDAGA1UE\nAwwpanNlZmxlci1mMTQtNWNhbmRsZXBpbi51c2Vyc3lzLnJlZGhhdC5jb20xCzAJ\nBgNVBAYTAlVTMRAwDgYDVQQHDAdSYWxlaWdoMB4XDTEzMDYyODAwMDAwMFoXDTE0\nMDYyODAwM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nPflH95tJg5TsunJDbQecSb40Z6Ejn5ZKluHihN0FvhM7NjCU4lhsUuktq7D36TTF\nHAOoA3b9S8dt1KMHalszEPmDmfcZDO7orbE=\n-----END CERTIFICATE-----\n-----BEGIN ENTITLEMENT DATA-----\neJytVMGOmzAU/JXI2iMUGwMBbu2pt0ptT61WkbFNFgVsapvNRlH+vc8kS0mTbLZS\nERI243meeWN5j7hWduikQSWqlrUoeEzDAhdVmFSFDItC8FAUtCrSOiVJzlCAfg1M\nucbtUBkHyA6V5abpXaMVKvfIbgaoxLbS6k5qG77k2SpLgKVYJwH5eEQWX74tam0W\nE7xlRjVqjUqKoajmG+ksKgmMHeMbQFaNADpBhwBpI7zePVJDV43Kxz9hni1Tiosz\niQSPJYyDVTEmNMRZGOffMS7H9wcslkocweQKCO1xhnFPX/rKjHM9KD8lMaWEUPiM\nonqjxcC96J97dNSK5098pweLTw2QA/QsjR17iegHQvyOhj81TnI3GOmro1PPHo/i\npBczbQnr3a73m+yG7s+OrN2ynQ2lYlUrRfjKC1DLKtm+teAZuqN9i520LjzNwC1z\nT/AzqrWO/Dg6FogejGwlsxJcnKT/rXndr1eDaa+RAQJSJx0TzLGVfOkbA+pjjA/B\nq0FC4uSWyctDN9m7hCZjX6VYfGZuZmrU5HQ0saKJdWoQKmvWWnnX4WUlAKNrJmk2\nc4lvOFS+r2+keAt/b4jqlNs/ujzn34oxO4+R0HsxXsvvfcE9VHAEvej5eYzmRf5v\nbo8HoPdat/5SGg3mrMB1Thit8yqhPIWbx4/ShMYCp4VAh8Nvryq6Eg==\n-----END ENTITLEMENT DATA-----\n-----BEGIN RSA SIGNATURE-----\nqpnBsJuVBk072icpvcA2OkwTa9BV9J052Rq13L+WjqAZx/A1bZC6kbdOXSjfdmhR\noY3eQPLsZadYfZBOZfSLSor4JoPO1NPDmT1adbnb4H4+UDUBJDpq+3OjHBAZVSuq\nPIhiIi0M7YT4MOCPr/Tl44wnnIXgiqMi0FYdmNhkWUE=\n-----END RSA SIGNAT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iXKj48t0Zjx5rJKoc\n+FOPEECAOrlrWqWpMKn9MIThytNZwC7W2e9qrNUCgYEA6Gvr+LBDj+g6xftUxD+t\nLMtj88gVwz540HCT0kPZjE3GonqPPffANlCcBYsJYfZJIU/waPYjjOFcVP3rSJ5I\nEp68IAfJw23BKO2oIKkTbCkgGMK01dk5bbVXSg7crMki3e3DyPPzNL05VYb0APfl\nyO0aObA9bBGEwiXipMAikp0CgYAbwQj1v5NKOgzy2CVdx5Eq80fdHUVeWSFsE97x\nsKGrawPIjI3hTBiwi07X648rFIXEUeYSSD5/qYKlQzD/y+LfgBmAyUsqlgb5jqsq\n6A6N1gHMrgvUweJcVdmoYtPEOSY4taOZ1QEBRt4TDjYXsESeFqBPjAfrkBBbnNq9\nwriW2QKBgQC3CnA9jdm42N5uV0eeZGM9Pc3oownInCp8j36Nx8L1Dq7qAbBTRVGH\nQiRH4gxLuMc6Mzhuz+YwpZLg705Wc+YIF3MzldgLm73HYNcOTQiaRjZ3X/dLqZ0D\nPaVNmvv6dCOgRnllq3G7Bn+gz/Z50QI9i4S8WgtP5jKXQ+3KOp+dRQ==\n-----END RSA PRIVATE KEY-----\n', 'serial': {'updated': '2013-06-28T16:24:36.711+0000', 'revoked': False, 'created': '2013-06-28T16:24:36.711+0000', 'expiration': '2014-06-28T00:00:00.000+0000', 'collected': False, 'serial': 301560389077337403, 'id': 301560389077337403}, 'id': '8a90f81a3f8b43c5013f8b99c07c3946'}
[Errno 2] No such file or directory: '/etc/pki/entitlement/301560389077337403-key.pem'
2013-06-28 12:24:37,122 [INFO]  @certlib.py:244 - certs updated:
Total updates: 0
Found (local) serial# []
Expected (UEP) serial# [301560389077337403]
Added (new)
  <NONE>
Deleted (rogue):
  <NONE>
Expired (deleted):
  <NONE>
Comment 2 Carter Kozak 2013-06-28 13:43:45 EDT
commit b6c8d57ae346b589fc504bb2adea08f8067ffbae
Author: ckozak <ckozak@redhat.com>
Date:   Fri Jun 28 13:02:24 2013 -0400

    979492: register auto-attach force recreates cert dirs
Comment 3 Shwetha Kallesh 2013-07-15 04:05:38 EDT
Marking verified!!

[root@localhost ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.8.16-1
subscription-manager: 1.8.13-1.el5
python-rhsm: 1.8.13-1.git.0.85d7af5.el5

      


[root@localhost ~]# subscription-manager register --username=testuser1 --org=admin --auto-attach
Password: 
The system has been registered with ID: 9408a468-a10e-42a1-bc33-b4d582f5f000 
Installed Product Current Status:
Product Name: Awesome OS for x86_64 Bits
Status:       Subscribed

[root@localhost ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS for x86_64
Provides:          Awesome OS for x86_64 Bits
SKU:               awesomeos-x86_64
Contract:          78
Account:           12331131231
Serial:            5700805218011325557
Pool ID:           8ac6a3a23fbcb162013fbcb26d7f06ea
Active:            True
Quantity Used:     4
Service Level:     
Service Type:      
Status Details:    
Starts:            07/08/2013
Ends:              07/08/2014

[root@localhost ~]# subscription-manager register --username=testuser1 --org=admin --auto-attach --force
The system with UUID 9408a468-a10e-42a1-bc33-b4d582f5f000 has been unregistered
Password: 
The system has been registered with ID: aa3f45d6-ca5e-4a72-bb24-7c4e56d6e16c 
Installed Product Current Status:
Product Name: Awesome OS for x86_64 Bits
Status:       Subscribed

[root@localhost ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS for x86_64
Provides:          Awesome OS for x86_64 Bits
SKU:               awesomeos-x86_64
Contract:          78
Account:           12331131231
Serial:            7765062570508742334
Pool ID:           8ac6a3a23fbcb162013fbcb26d7f06ea
Active:            True
Quantity Used:     4
Service Level:     
Service Type:      
Status Details:    
Starts:            07/08/2013
Ends:              07/08/2014

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