Bug 1345962 - unbound method endheaders() must be called with HTTPSConnection instance as first argument (got RhsmProxyHTTPSConnection instance instead)
Summary: unbound method endheaders() must be called with HTTPSConnection instance as f...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: python-rhsm
Version: 7.3
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Alex Wood
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-13 13:59 UTC by John Sefler
Modified: 2016-11-03 20:29 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 20:29:31 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2592 normal SHIPPED_LIVE Moderate: subscription-manager security, bug fix, and enhancement update 2016-11-03 12:10:42 UTC

Description John Sefler 2016-06-13 13:59:09 UTC
Description of problem:
When trying to register (as well as any other sub-man module) using a valid proxy, a failure occurs.  I suspect that this is the offending python-rhsm commit...

636d167c6f0c7a2266535892137391d227abbb62 Merge pull request #170 from candlepin/awood/socket-timeout

    Commit: 5780140650a59d45a03372a0390f92fd7c3301eb
    Allow users to set socket timeout.
    Remove the old method of setting a universal timeout (which was required 
    due to limitations in Python versions that we don't support any more) 
    and instead specify the timeout on a per-connection basis.

    Commit: 8cffbd466b6ab09ea92acf7c8ce127b59d5fa32f
    Correct misspellings and old Python except syntax.


Version-Release number of selected component (if applicable):
[root@jsefler-rhel7 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 0.9.51.19-1
subscription management rules: 5.15.1
subscription-manager: 1.17.7-1.git.0.7a8354d.el7
python-rhsm: 1.17.2-1.git.5.5780140.el7


How reproducible:


Steps to Reproduce:
[root@jsefler-rhel7 ~]# subscription-manager register --serverurl=subscription.rhsm.stage.redhat.com:443/subscription --user=qa@redhat.com --proxy=auto-services.usersys.redhat.com:3128 --proxyuser=redhat --proxypassword=redhat
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Password: 
unbound method endheaders() must be called with HTTPSConnection instance as first argument (got RhsmProxyHTTPSConnection instance instead)
[root@jsefler-rhel7 ~]# echo $?
70
[root@jsefler-rhel7 ~]# tail -f /var/log/rhsm/rhsm.log

2016-06-13 09:28:04,732 [DEBUG] subscription-manager:5570 @ga_loader.py:89 - ga_loader GaImporterGtk3
2016-06-13 09:28:04,739 [DEBUG] subscription-manager:5570 @plugins.py:569 - loaded plugin modules: [<module 'container_content' from '/usr/share/rhsm-plugins/container_content.pyc'>, <module 'ostree_content' from '/usr/share/rhsm-plugins/ostree_content.pyc'>]
2016-06-13 09:28:04,739 [DEBUG] subscription-manager:5570 @plugins.py:570 - loaded plugins: {'container_content.ContainerContentPlugin': <container_content.ContainerContentPlugin object at 0x26ef810>, 'ostree_content.OstreeContentPlugin': <ostree_content.OstreeContentPlugin object at 0x26efdd0>}
2016-06-13 09:28:04,739 [DEBUG] subscription-manager:5570 @identity.py:131 - Loading consumer info from identity certificates.
2016-06-13 09:28:04,740 [DEBUG] subscription-manager:5570 @identity.py:146 - Reload of consumer identity cert /etc/pki/consumer/cert.pem raised an exception with msg: [Errno 2] No such file or directory: '/etc/pki/consumer/key.pem'
2016-06-13 09:28:04,780 [INFO] subscription-manager:5570 @managercli.py:384 - Client Versions: {'python-rhsm': '1.17.2-1.git.5.5780140.el7', 'subscription-manager': '1.17.7-1.git.0.7a8354d.el7'}
2016-06-13 09:28:04,780 [INFO] subscription-manager:5570 @connection.py:830 - Connection built: http_proxy=auto-services.usersys.redhat.com:3128 host=jsefler-candlepin.usersys.redhat.com port=8443 handler=/candlepin auth=identity_cert ca_dir=/etc/rhsm/ca/ verify=False
2016-06-13 09:28:04,781 [INFO] subscription-manager:5570 @connection.py:830 - Connection built: http_proxy=auto-services.usersys.redhat.com:3128 host=jsefler-candlepin.usersys.redhat.com port=8443 handler=/candlepin auth=none
2016-06-13 09:28:04,823 [INFO] subscription-manager:5570 @managercli.py:384 - Client Versions: {'python-rhsm': '1.17.2-1.git.5.5780140.el7', 'subscription-manager': '1.17.7-1.git.0.7a8354d.el7'}
2016-06-13 09:28:04,836 [INFO] subscription-manager:5570 @managercli.py:359 - Consumer Identity name=None uuid=None
2016-06-13 09:28:04,865 [INFO] subscription-manager:5570 @managercli.py:359 - Consumer Identity name=None uuid=None
2016-06-13 09:28:04,866 [INFO] subscription-manager:5570 @connection.py:830 - Connection built: http_proxy=auto-services.usersys.redhat.com:3128 host=jsefler-candlepin.usersys.redhat.com port=8443 handler=/candlepin auth=basic username=testuser1
2016-06-13 09:28:04,883 [DEBUG] subscription-manager:5570 @hwprobe.py:580 - cpu info: {'cpu.cpu(s)': 2, 'cpu.core(s)_per_socket': 1, 'cpu.thread(s)_per_core': 1, 'cpu.topology_source': 'kernel /sys cpu sibling lists', 'cpu.cpu_socket(s)': 2}
2016-06-13 09:28:04,967 [DEBUG] subscription-manager:5570 @hwprobe.py:798 - Running 'virt-what'
2016-06-13 09:28:04,993 [DEBUG] subscription-manager:5570 @hwprobe.py:802 - virt-what stdout: kvm

2016-06-13 09:28:04,993 [DEBUG] subscription-manager:5570 @hwprobe.py:803 - virt-what stderr: 
2016-06-13 09:28:05,001 [INFO] subscription-manager:5570 @hwprobe.py:908 - collected virt facts: virt.is_guest=True, virt.host_type=kvm, virt.uuid=672A2A41-EFBD-463F-B8A0-543C292AAEAB
2016-06-13 09:28:05,003 [DEBUG] subscription-manager:5570 @connection.py:525 - Loaded CA certificates from /etc/rhsm/ca/: jsefler-candlepin.pem, jsefler-os-candlepin.pem, jsefler-candlepin7.pem, jsefler-candlepin6.pem, redhat-uep.pem, redhat-entitlement-authority.pem
2016-06-13 09:28:05,003 [DEBUG] subscription-manager:5570 @connection.py:558 - Using proxy: auto-services.usersys.redhat.com:3128
2016-06-13 09:28:05,003 [DEBUG] subscription-manager:5570 @connection.py:573 - Making request: GET https://jsefler-candlepin.usersys.redhat.com:8443/candlepin/
2016-06-13 09:28:05,004 [ERROR] subscription-manager:5570 @managercli.py:174 - Error during registration: unbound method endheaders() must be called with HTTPSConnection instance as first argument (got RhsmProxyHTTPSConnection instance instead)
2016-06-13 09:28:05,005 [ERROR] subscription-manager:5570 @managercli.py:175 - unbound method endheaders() must be called with HTTPSConnection instance as first argument (got RhsmProxyHTTPSConnection instance instead)
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/subscription_manager/managercli.py", line 1119, in _do_command
    self.options.environment)
  File "/usr/lib/python2.7/site-packages/subscription_manager/managercli.py", line 1219, in _get_environment_id
    supports_environments = cp.supports_resource('environments')
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 856, in supports_resource
    self._load_supported_resources()
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 843, in _load_supported_resources
    resources_list = self.conn.request_get("/")
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 694, in request_get
    return self._request("GET", method)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 584, in _request
    conn.request(request_type, handler, body=body, headers=headers)
  File "/usr/lib64/python2.7/httplib.py", line 979, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib64/python2.7/httplib.py", line 1013, in _send_request
    self.endheaders(body)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 290, in endheaders
    HTTPSConnection.endheaders(self)
TypeError: unbound method endheaders() must be called with HTTPSConnection instance as first argument (got RhsmProxyHTTPSConnection instance instead)


Actual results:


Expected results:


Additional info:

Comment 1 Alex Wood 2016-06-13 19:48:24 UTC
PR up at https://github.com/candlepin/python-rhsm/pull/172

Comment 2 Chris Snyder 2016-06-13 20:55:35 UTC
Fix in commit below:

commit c60b8ad4d4329616b8df6cce849f4313ec675d47
Author: Alex Wood <awood@redhat.com>
Date:   Mon Jun 13 13:28:04 2016 -0400

    Don't call static methods on a class that doesn't have them.

Comment 4 Alex Wood 2016-06-14 19:18:59 UTC
Merged c60b8ad

Comment 6 Shwetha Kallesh 2016-06-24 11:07:07 UTC
reproducer :
----------------------------------------
[root@dhcp35-45 home]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.51.15-1
subscription management rules: 5.15.1
subscription-manager: 1.17.7-1.git.0.7a8354d.el7
python-rhsm: 1.17.2-1.git.5.5780140.el7

[root@dhcp35-45 home]# subscription-manager register --serverurl=subscription.rhn.stage.redhat.com:443/subscription --user=qa@redhat.com --proxy=auto-services.usersys.redhat.com:3128 --proxyuser=**** --proxypassword=***
This system is already registered. Use --force to override
[root@dhcp35-45 home]# subscription-manager register --serverurl=subscription.rhn.stage.redhat.com:443/subscription --user=qa@redhat.com --proxy=auto-services.usersys.redhat.com:3128 --proxyuser=redhat --proxypassword=redhat --force
Registering to: subscription.rhn.stage.redhat.com:443/subscription
Password: 
unbound method endheaders() must be called with HTTPSConnection instance as first argument (got RhsmProxyHTTPSConnection instance instead)

Verification:
----------------------------------

[root@dhcp35-45 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.51.15-1
subscription management rules: 5.15.1
subscription-manager: 1.17.8-1.el7
python-rhsm: 1.17.4-1.el7


[root@dhcp35-45 ~]# subscription-manager register --serverurl=subscription.rhn.stage.redhat.com:443/subscription --user=qa@redhat.com --proxy=auto-services.usersys.redhat.com:3128 --proxyuser=*** --proxypassword=*** --force
The system with UUID f8639cfa-71c1-4f15-b0ff-78b3a7727714 has been unregistered
Registering to: subscription.rhn.stage.redhat.com:443/subscription
Password: 
The system has been registered with ID: 20754727-b6ff-4ec2-b6cd-f19911b7a38b 

Moveing bug to verified state

Comment 8 errata-xmlrpc 2016-11-03 20:29:31 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-2016-2592.html


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