Bug 1397201 - AttributeError: 'module' object has no attribute 'BadStatusLine'
Summary: AttributeError: 'module' object has no attribute 'BadStatusLine'
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager
Version: 6.9
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: rc
: ---
Assignee: Kevin Howell
QA Contact: John Sefler
URL:
Whiteboard:
: 1400817 1402220 (view as bug list)
Depends On:
Blocks: 1401884
TreeView+ depends on / blocked
 
Reported: 2016-11-21 21:48 UTC by John Sefler
Modified: 2017-03-21 10:57 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-03-21 10:57:33 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Github candlepin python-rhsm pull 193 None closed 1397201: Expose classes in m2crypto wrapper 2020-04-30 10:13:14 UTC
Red Hat Product Errata RHSA-2017:0698 normal SHIPPED_LIVE Moderate: subscription-manager security, bug fix, and enhancement update 2017-03-21 12:39:12 UTC

Description John Sefler 2016-11-21 21:48:07 UTC
Description of problem:
With the latest continuous integration build of RHSM, a call to the refresh module is throwing a Traceback "AttributeError: 'module' object has no attribute 'BadStatusLine'" when trying to call refresh after the registered consumer has been deleted server-side.  Rather than a hitting a traceback, we should be told that "Unit {UUID} has been deleted".


Version-Release number of selected component (if applicable):
[root@jsefler-rhel6 ~]# subscription-manager version 
server type: Red Hat Subscription Management
subscription management server: 0.9.51.20-1
subscription management rules: 5.15.1
subscription-manager: 1.18.4-1.git.10.dfae74e.el6
python-rhsm: 1.18.4-1.git.9.bd3c973.el6


How reproducible:
  Is NOT happening with...
     subscription-manager: 1.18.4-1.el6
     python-rhsm: 1.18.4-1.el6
  IS happening with...
     subscription-manager: 1.18.4-1.git.10.dfae74e.el6
     python-rhsm: 1.18.4-1.git.9.bd3c973.el6


Steps to Reproduce:

[root@jsefler-rhel6 ~]# subscription-manager register --username=qa@redhat.com --serverurl=subscription.rhsm.stage.redhat.com:443/subscription
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Password: 
The system has been registered with ID: 014c80ab-fcf1-406e-96df-4d1886992902 

[root@jsefler-rhel6 ~]# curl --stderr /dev/null --insecure --user qa@redhat.com:REDACTED --request DELETE http://candlepin.dist.stage.ext.phx2.redhat.com/candlepin/consumers/014c80ab-fcf1-406e-96df-4d1886992902

[root@jsefler-rhel6 ~]# subscription-manager identity
Unit 014c80ab-fcf1-406e-96df-4d1886992902 has been deleted

[root@jsefler-rhel6 ~]# subscription-manager refresh
'module' object has no attribute 'BadStatusLine'

[root@jsefler-rhel6 ~]# tail -f /var/log/rhsm/rhsm.log
2016-11-21 16:33:42,077 [DEBUG] subscription-manager:7910:MainThread @connection.py:490 - Making request: PUT /subscription/consumers/014c80ab-fcf1-406e-96df-4d1886992902/certificates?lazy_regen=true
2016-11-21 16:33:42,770 [INFO] subscription-manager:7910:MainThread @connection.py:525 - Response: status=410, request="PUT /subscription/consumers/014c80ab-fcf1-406e-96df-4d1886992902/certificates?lazy_regen=true"
2016-11-21 16:33:42,771 [ERROR] subscription-manager:7910:MainThread @managercli.py:177 - Unable to perform refresh due to the following exception: 'module' object has no attribute 'BadStatusLine'
2016-11-21 16:33:42,772 [ERROR] subscription-manager:7910:MainThread @managercli.py:178 - 'module' object has no attribute 'BadStatusLine'
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/subscription_manager/managercli.py", line 664, in _do_command
    if not self.cp.regenEntitlementCertificates(identity.uuid, True):
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 1290, in regenEntitlementCertificates
    except (RemoteServerException, httplib.BadStatusLine, RestlibException) as e:
AttributeError: 'module' object has no attribute 'BadStatusLine'




Actual results:
  'module' object has no attribute 'BadStatusLine'

Expected results:
  Unit 014c80ab-fcf1-406e-96df-4d1886992902 has been deleted

Additional info:



For comparison, here is the corresponding /var/log/rhsm/rhsm.log with subscription-manager: 1.18.4-1.el6

2016-11-21 16:40:34,874 [DEBUG] subscription-manager:8809:MainThread @connection.py:577 - Making request: PUT /subscription/consumers/172c9d1a-f6c8-4a73-82c6-c4772b7a3ee0/certificates?lazy_regen=true
2016-11-21 16:40:35,561 [DEBUG] subscription-manager:8809:MainThread @connection.py:610 - Response: status=410
2016-11-21 16:40:35,562 [ERROR] subscription-manager:8809:MainThread @managercli.py:671 - Unit 172c9d1a-f6c8-4a73-82c6-c4772b7a3ee0 has been deleted

Comment 3 Chris Snyder 2016-12-05 16:18:53 UTC
*** Bug 1400817 has been marked as a duplicate of this bug. ***

Comment 4 Kevin Howell 2016-12-08 16:02:54 UTC
*** Bug 1402220 has been marked as a duplicate of this bug. ***

Comment 6 Rehana 2016-12-12 12:03:57 UTC
Verifying on :

# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.51.20-1
subscription management rules: 5.15.1
subscription-manager: 1.18.6-1.el6
python-rhsm: 1.18.6-1.el6

# subscription-manager register --username=qa@redhat.com --serverurl=subscription.rhsm.stage.redhat.com:443/subscription
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Password: 
The system has been registered with ID: c953dc37-cd64-41fe-8cc6-eac810ea1205 
#  curl --stderr /dev/null --insecure --user qa@redhat.com:<password> --request DELETE http://candlepin.dist.stage.ext.phx2.redhat.com/candlepin/consumers/c953dc37-cd64-41fe-8cc6-eac810ea1205

# subscription-manager identity
Unit c953dc37-cd64-41fe-8cc6-eac810ea1205 has been deleted
# subscription-manager refresh
Unit c953dc37-cd64-41fe-8cc6-eac810ea1205 has been deleted


rhsm.log:
======
2016-12-12 06:59:01,428 [INFO] subscription-manager:28708:MainThread @connection.py:758 - Connection built: host=subscription.rhsm.stage.redhat.com port=443 handler=/subscription auth=none
2016-12-12 06:59:01,428 [INFO] subscription-manager:28708:MainThread @managercli.py:364 - Consumer Identity name=dhcp70-150.rhts.eng.bos.redhat.com uuid=c953dc37-cd64-41fe-8cc6-eac810ea1205
2016-12-12 06:59:02,046 [INFO] subscription-manager:28708:MainThread @connection.py:525 - Response: status=410, request="PUT /subscription/consumers/c953dc37-cd64-41fe-8cc6-eac810ea1205/certificates?lazy_regen=true"
2016-12-12 06:59:02,048 [ERROR] subscription-manager:28708:MainThread @managercli.py:672 - Unit c953dc37-cd64-41fe-8cc6-eac810ea1205 has been deleted

Observed that now " Unit c953dc37-cd64-41fe-8cc6-eac810ea1205 has been deleted" message is displayed on subscription-manager refresh command; and no error was observed on cli and rhsm.log. Hence marking as Verified!!

Comment 8 errata-xmlrpc 2017-03-21 10:57:33 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.

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.