Description of problem: The xmlrpclib library changed in Python 2.7 and rhn-migrate-classic-to-rhsm no longer works when going through a proxy. How reproducible: Always Steps to Reproduce: 1. Set up RHN to use a proxy. You need to edit the proxy related values in /etc/sysconfig/rhn/up2date. 2. Register to RHN using rhnreg_ks. 3. Attempt a migration. Actual results: 2013-02-19 16:54:19,512 [INFO] @migrate.py:340 - Using proxy auto-services.user sys.redhat.com:3128 for RHN API methods 2013-02-19 16:54:19,537 [ERROR] @migrate.py:348 - Traceback (most recent call l ast): File "/root/devel/subscription-manager/src/subscription_manager/migrate/migrat e.py", line 345, in connect_to_rhn sk = sc.auth.login(credentials.username, credentials.password) File "/usr/lib64/python2.7/xmlrpclib.py", line 1224, in __call__ return self.__send(self.__name, args) File "/usr/lib64/python2.7/xmlrpclib.py", line 1578, in __request verbose=self.__verbose File "/usr/lib64/python2.7/xmlrpclib.py", line 1264, in request return self.single_request(host, handler, request_body, verbose) File "/usr/lib64/python2.7/xmlrpclib.py", line 1294, in single_request response = h.getresponse(buffering=True) AttributeError: HTTP instance has no attribute 'getresponse' Expected results: A successful migration Additional info:
This bug is closely related to bug #619276. To paraphrase David Malcolm in comment 11 of that bug: The xmlrpclib Transport.request() (in Python 2.7 request() delegates calls to single_request()) method calls make_connection() which returns a connection object (httplib.HTTP prior to 2.7 and httplib.HTTPConnection in 2.7) Eventually a call is made on the object returned from make_connection(). Python's xmlrpclib has changed from calling getreply() to getresponse() in r73638 [1] [2]. httplib.HTTP does not have a getresponse() method. It does have a getreply() method (which delegates to an underlying connection instance's getresponse(), with some wrapper logic). Since we were overriding make_connection() and returning an httplib.HTTP object, we broke when xmlrpclib in 2.7 tried to call getresponse(). The fix is to discriminate between 2.7 and earlier versions. I have elected to do that by looking for the single_request() method which doesn't exist in pre-2.7. This technique is the same as the one used by koji in commit 7876bc06 [3]. [1] http://svn.python.org/view?view=rev&revision=73638 [2] http://svn.python.org/view/python/trunk/Lib/xmlrpclib.py?r1=73638&r2=73637&pathrev=73638 [3] http://git.fedorahosted.org/cgit/koji/commit/?id=7876bc06fe9151fb521409c2e8f6a3535e1eacfe
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.
This bug should be fixed as a side effect of fixing bug 885130 since we are no longer using xmlrpclib.
Created attachment 746210 [details] A fix for this issue A fix for this issue for posterity's sake.