Description of problem: rhsm-debug system is throwing a traceback for the following negative testcase that tries to call rhsm-debug system --destination=/tmp/foofile where /tmp/foofile exists but is not a directory. Version-Release number of selected component (if applicable): [root@jsefler-5 ~]# subscription-manager version server type: Red Hat Subscription Management subscription management server: 0.9.10-1 subscription-manager: 1.11.3-2.el5 python-rhsm: 1.11.3-2.el5 How reproducible: Steps to Reproduce: [root@jsefler-5 ~]# subscription-manager register --insecure --serverurl=jsefler-f14-candlepin.usersys.redhat.com:8443/candlepin Username: testuser1 Password: Organization: admin The system has been registered with ID: c8292d8f-ecb8-4568-99ba-c28cc951f298 [root@jsefler-5 ~]# touch /tmp/foofile [root@jsefler-5 ~]# rhsm-debug system --destination=/tmp/foofile local variable 'dest_fo' referenced before assignment Actual results: above Expected results: [Errno 20] Not a directory: '/tmp/foofile/rhsm-debug-system-20140501-342280.tar.gz' I claim this is expected result because this was the behavior on rhel7 and the error message is more descriptive of the problem than the traceback we are now seeing in rhel5. Additional info: [root@jsefler-5 ~]# tail -f /var/log/rhsm/rhsm.log 2014-05-01 10:44:22,262 [ERROR] rhsm-debug @managercli.py:156 - Unable to create zip file of system information: local variable 'dest_fo' referenced before assignment 2014-05-01 10:44:22,262 [ERROR] rhsm-debug @managercli.py:157 - local variable 'dest_fo' referenced before assignment Traceback (most recent call last): File "/usr/share/rhsm/rhsm_debug/debug_commands.py", line 158, in _do_command sfm.move(tar_file_path, final_path) File "/usr/share/rhsm/rhsm_debug/debug_commands.py", line 261, in move dest_fo.close() UnboundLocalError: local variable 'dest_fo' referenced before assignment
commit dc23acfe0e863ad2cda5d57900621bfe0ba6a2a9 Author: ckozak <ckozak> Date: Thu May 1 11:05:47 2014 -0400 1093382: fix file io problems created when replacing with() blocks
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.
Version: # subscription-manager version server type: Red Hat Subscription Management subscription management server: 0.9.12-1 subscription-manager: 1.11.3-3.el5 python-rhsm: 1.11.3-3.el5 Verification: Steps followed as per comment1 # subscription-manager clean All local data removed # subscription-manager identity This system is not yet registered. Try 'subscription-manager register --help' for more information. # subscription-manager register --insecure --serverurl=f20-candlepin.usersys.redhat.com:8443/candlepin Username: testuser1 Password: Organization: admin The system has been registered with ID: de45398c-4c4d-40c1-957b-925ec8b32e18 # touch /tmp/foofile # rhsm-debug system --destination=/tmp/foofile [Errno 20] Not a directory: '/tmp/foofile/rhsm-debug-system-20140521-151745.tar.gz' <<<<<<<<<<<<<<<<< Additional Info: 2014-05-21 15:17:45,284 [DEBUG] rhsm-debug @connection.py:450 - Making request: GET /candlepin/status 2014-05-21 15:17:45,544 [DEBUG] rhsm-debug @connection.py:473 - Response: status=200, requestUuid=03719181-f82f-4276-b948-0b15b9fce5c0 2014-05-21 15:17:45,545 [INFO] rhsm-debug @managercli.py:304 - Server Versions: {'candlepin': '0.9.12-1', 'server-type': 'Red Hat Subscription Management'} 2014-05-21 15:17:45,545 [DEBUG] rhsm-debug @identity.py:130 - Loading consumer info from identity certificates. 2014-05-21 15:17:45,548 [DEBUG] rhsm-debug @connection.py:450 - Making request: GET /candlepin/consumers/de45398c-4c4d-40c1-957b-925ec8b32e18/owner 2014-05-21 15:17:45,854 [DEBUG] rhsm-debug @connection.py:473 - Response: status=200, requestUuid=dada671c-ba68-4e93-8e27-97d6325c994e 2014-05-21 15:17:45,856 [DEBUG] rhsm-debug @connection.py:450 - Making request: GET /candlepin/owners/admin/subscriptions 2014-05-21 15:17:46,538 [DEBUG] rhsm-debug @connection.py:473 - Response: status=200, requestUuid=f6e6453a-58e7-4f49-8187-a0b368e382fb 2014-05-21 15:17:46,857 [DEBUG] rhsm-debug @connection.py:450 - Making request: GET /candlepin/consumers/de45398c-4c4d-40c1-957b-925ec8b32e18 2014-05-21 15:17:47,215 [DEBUG] rhsm-debug @connection.py:473 - Response: status=200, requestUuid=fb47b16e-4768-4f6f-b820-de20c005ee30 2014-05-21 15:17:47,219 [DEBUG] rhsm-debug @connection.py:450 - Making request: GET /candlepin/consumers/de45398c-4c4d-40c1-957b-925ec8b32e18/compliance 2014-05-21 15:17:47,529 [DEBUG] rhsm-debug @connection.py:473 - Response: status=200, requestUuid=0ecd186e-a3f1-4e11-8f1c-de59c91ae635 2014-05-21 15:17:47,530 [DEBUG] rhsm-debug @connection.py:450 - Making request: GET /candlepin/consumers/de45398c-4c4d-40c1-957b-925ec8b32e18/entitlements?exclude=certificates.key&exclude=certificates.cert 2014-05-21 15:17:47,827 [DEBUG] rhsm-debug @connection.py:473 - Response: status=200, requestUuid=07c09e99-af1c-4daf-87ea-e789c089c91f 2014-05-21 15:17:47,829 [DEBUG] rhsm-debug @connection.py:450 - Making request: GET /candlepin/owners/admin/pools?consumer=de45398c-4c4d-40c1-957b-925ec8b32e18&listall=true 2014-05-21 15:17:50,013 [DEBUG] rhsm-debug @connection.py:473 - Response: status=200, requestUuid=4783c330-35df-4806-afb8-518202f1fdf2 2014-05-21 15:17:50,563 [ERROR] rhsm-debug @managercli.py:156 - Unable to create zip file of system information: [Errno 20] Not a directory: '/tmp/foofile/rhsm-debug-system-20140521-151745.tar.gz' 2014-05-21 15:17:50,563 [ERROR] rhsm-debug @managercli.py:157 - [Errno 20] Not a directory: '/tmp/foofile/rhsm-debug-system-20140521-151745.tar.gz' Traceback (most recent call last): File "/usr/share/rhsm/rhsm_debug/debug_commands.py", line 158, in _do_command sfm.move(tar_file_path, final_path) File "/usr/share/rhsm/rhsm_debug/debug_commands.py", line 257, in move dest_fo = self._open_excl(dest) File "/usr/share/rhsm/rhsm_debug/debug_commands.py", line 270, in _open_excl self.default_perms), 'w+') OSError: [Errno 20] Not a directory: '/tmp/foofile/rhsm-debug-system-20140521-151745.tar.gz'
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-2014-1225.html