Hide Forgot
Description of problem: I get blocked by an "int argument required" when I try to run subscription-manager commands through a proxy. Version-Release number of selected component (if applicable): [root@jsefler-onprem-5server ~]# rpm -q subscription-manager subscription-manager-0.95.5.5-1.git.17.0109842.el5 Recreate against an onpremises candlepin with TESTDATA... [root@jsefler-onprem-5server ~]# subscription-manager register --username=testuser1 --password=password --force --proxy=auto-services.usersys.redhat.com:3128 --proxyuser=redhat --proxypassword=redhat int argument required [root@jsefler-onprem-5server ~]# tail -f /var/log/rhsm/rhsm.log 2011-04-08 12:46:41,493 [INFO] @connection.py:295 - Using certificate authentication: key = /etc/pki/consumer/key.pem, cert = /etc/pki/consumer/cert.pem, ca = /etc/rhsm/ca/, insecure = False 2011-04-08 12:46:41,493 [INFO] @connection.py:300 - Connection Established: host: jsefler-f14-5candlepin.usersys.redhat.com, port: 8443, handler: /candlepin 2011-04-08 12:46:41,555 [INFO] @connection.py:287 - Using basic authentication as: testuser1 2011-04-08 12:46:41,555 [INFO] @connection.py:300 - Connection Established: host: jsefler-f14-5candlepin.usersys.redhat.com, port: 8443, handler: /candlepin 2011-04-08 12:46:41,679 [DEBUG] @certlib.py:660 - Sorting product and entitlement cert status for: 2011-04-08 12:46:41.679365 2011-04-08 12:46:41,698 [DEBUG] @certlib.py:679 - Installed product IDs: ['917571', '100000000000000', '1144', '37090', '1', '37065', '37069', '37068', '37080', '27060', '37067', '37060', '37070', '37062'] 2011-04-08 12:46:41,699 [DEBUG] @certlib.py:670 - valid entitled products: [] 2011-04-08 12:46:41,699 [DEBUG] @certlib.py:671 - expired entitled products: [] 2011-04-08 12:46:41,700 [INFO] @connection.py:147 - loading ca pem certificates from: /etc/rhsm/ca/ 2011-04-08 12:46:41,700 [INFO] @connection.py:134 - loading ca certificate '/etc/rhsm/ca/redhat-uep.pem' 2011-04-08 12:46:41,701 [INFO] @connection.py:134 - loading ca certificate '/etc/rhsm/ca/fakamai-cp1.pem' 2011-04-08 12:46:41,701 [INFO] @connection.py:134 - loading ca certificate '/etc/rhsm/ca/jsefler-f14-5candlepin.pem' 2011-04-08 12:46:41,701 [INFO] @connection.py:134 - loading ca certificate '/etc/rhsm/ca/candlepin-stage.pem' 2011-04-08 12:46:41,702 [INFO] @connection.py:149 - work in insecure mode ?:False 2011-04-08 12:46:41,702 [INFO] @connection.py:156 - using proxy auto-services.usersys.redhat.com:3128 2011-04-08 12:46:41,702 [INFO] @connection.py:163 - handler: https://jsefler-f14-5candlepin.usersys.redhat.com:8443/candlepin/consumers/ 2011-04-08 12:46:41,737 [ERROR] @managercli.py:47 - Error during registration: int argument required 2011-04-08 12:46:41,737 [ERROR] @managercli.py:48 - int argument required Traceback (most recent call last): File "/usr/share/rhsm/subscription_manager/managercli.py", line 424, in _do_command facts=self.facts.get_facts()) File "/usr/lib/python2.4/site-packages/rhsm/connection.py", line 323, in registerConsumer return self.conn.request_post('/consumers/', params) File "/usr/lib/python2.4/site-packages/rhsm/connection.py", line 203, in request_post return self._request("POST", method, params) File "/usr/lib/python2.4/site-packages/rhsm/connection.py", line 169, in _request headers=self.headers) File "/usr/lib64/python2.4/httplib.py", line 810, in request self._send_request(method, url, body, headers) File "/usr/lib64/python2.4/httplib.py", line 833, in _send_request self.endheaders() File "/usr/lib/python2.4/site-packages/rhsm/connection.py", line 89, in endheaders httpslib.HTTPSConnection.endheaders(self) File "/usr/lib64/python2.4/httplib.py", line 804, in endheaders self._send_output() File "/usr/lib64/python2.4/httplib.py", line 685, in _send_output self.send(msg) File "/usr/lib64/python2.4/httplib.py", line 652, in send self.connect() File "/usr/lib64/python2.4/site-packages/M2Crypto/httpslib.py", line 155, in connect self.sock.sendall(self._get_connect_msg()) File "/usr/lib64/python2.4/site-packages/M2Crypto/httpslib.py", line 169, in _get_connect_msg msg = "CONNECT %s:%d HTTP/1.1\r\n" % (self._real_host, self._real_port) TypeError: int argument required
I've got a patch out for review, but it's a touch ugly. This seems to be a bug in the version of m2crypto on rhel5. In the class for ProxyHttps, it's is finding the port of the serverUrl by catting together hostname (string) and port (int) into a string, then later on calling urllib.stripport() to get the host and port as strings. Which it then trys to format into a string as a "%d" message format giving the end of the traceback above. The port is an int everywhere except in m2cryptos httpslib, so hard to fix in subscription-manager. The fix I have is to override the _get_connect_msg in M2Crypto/httpslib.py (we already have a sub class of the httpsProxy class) and fix it there. As far as I can tell, we only need this on RHEL5.
Created attachment 491311 [details] patch to fix httpslib
commit 4dcef0ad6d9a209f36b2070b065d86d708968a82 Author: Adrian Likins <alikins> Date: Mon Apr 11 13:41:05 2011 -0400 694870: workaround a bug in httpslib.ProxyHttpsConnection a string returned from urllib.splitport() was getting passed to "%d" formatted string Add our own version of "_get_connect_msg" to workaroun it
Pushed now.
this works with proxies configured with and without password authentication (using cli proxy configuration and/or conf file proxy configuration). Marking VERIFIED. [root@jmolet-57server ~]# subscription-manager register --username=testuser1 --password=password --force --proxy=auto-services.usersys.redhat.com:3128 --proxyuser=redhat --proxypassword=redhat 258afff1-8fb6-4777-9075-95f638d629cb jmolet-57server.usersys.redhat.com [root@jmolet-57server ~]# subscription-manager register --username=testuser1 --password=password --force --proxy=auto-services.usersys.redhat.com:3129 The system with UUID 258afff1-8fb6-4777-9075-95f638d629cb has been unregistered b72f0890-9443-456f-aa23-43abe74acd77 jmolet-57server.usersys.redhat.com [root@jmolet-57server ~]# rpm -qa | grep subscription-manager subscription-manager-gnome-0.95.5.10-1.git.6.ad7cd7d.el5 subscription-manager-firstboot-0.95.5.10-1.git.6.ad7cd7d.el5 subscription-manager-0.95.5.10-1.git.6.ad7cd7d.el5
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHEA-2011-1077.html