Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1397201

Summary: AttributeError: 'module' object has no attribute 'BadStatusLine'
Product: Red Hat Enterprise Linux 6 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Kevin Howell <khowell>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: medium Docs Contact:
Priority: high    
Version: 6.9CC: bcourt, hsun, qianzhan, redakkan, skallesh
Target Milestone: rcKeywords: Regression, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-21 10:57:33 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: 1401884    

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 --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: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 --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:<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