Hide Forgot
Description of problem: Setting proxy config values in rhsm.conf are failing when used with redeem module. Version-Release number of selected component (if applicable): [root@jsefler-onprem-62server ~]# rpm -q subscription-manager subscription-manager-0.96.6-1.git.8.6e109e4.el6.x86_64 [root@jsefler-onprem-62server ~]# rpm -q python-rhsm python-rhsm-0.96.9-1.git.3.328723e.el6.noarch How reproducible: Steps to Reproduce: Setup subscription manager with a candlepin server deployed with TESTDATA=1 [root@jsefler-onprem-62server ~]# subscription-manager register --username=testuser1 --password=password --org=adminThe system has been registered with id: cd3531fc-e76e-4fb3-bd0b-4789863caede Edit /etc/rhsm/rhsm.conf with the following proxy values: [root@jsefler-onprem-62server ~]# grep proxy /etc/rhsm/rhsm.conf # an http proxy server to use proxy_hostname=FOO # port for http proxy server proxy_port=1234 # user name for authenticating to an http proxy, if needed proxy_user= # password for basic http proxy auth, if needed proxy_password= [root@jsefler-onprem-62server ~]# subscription-manager redeem --email=proxytester --locale=en-us 'gaierror' object has no attribute 'code' ^^^^^ DID NOT EXPECT THIS ERROR. Actual results: 'gaierror' object has no attribute 'code' Expected results: Network error, unable to connect to server. Please see /var/log/rhsm/rhsm.log for more information. Additional info: [root@jsefler-onprem-62server ~]# tail -f /var/log/rhsm/rhsm.log 2011-08-22 12:53:04,045 [INFO] @connection.py:348 - Using certificate authentication: key = /etc/pki/consumer/key.pem, cert = /etc/pki/consumer/cert.pem, ca = /etc/rhsm/ca/, insecure = False 2011-08-22 12:53:04,046 [DEBUG] @connection.py:188 - Loading CA PEM certificates from: /etc/rhsm/ca/ 2011-08-22 12:53:04,047 [DEBUG] @connection.py:171 - Loading CA certificate: '/etc/rhsm/ca/fakamai-cp1.pem' 2011-08-22 12:53:04,047 [DEBUG] @connection.py:171 - Loading CA certificate: '/etc/rhsm/ca/jsefler-onprem-62candlepin.pem' 2011-08-22 12:53:04,047 [DEBUG] @connection.py:171 - Loading CA certificate: '/etc/rhsm/ca/redhat-uep.pem' 2011-08-22 12:53:04,048 [DEBUG] @connection.py:171 - Loading CA certificate: '/etc/rhsm/ca/candlepin-stage.pem' 2011-08-22 12:53:04,048 [DEBUG] @connection.py:194 - Using proxy: FOO:1234 2011-08-22 12:53:04,049 [DEBUG] @connection.py:209 - Making request: GET https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/ 2011-08-22 12:53:04,078 [WARNING] @connection.py:381 - Error fetching supported resources, this UEPConnection is likely not usable: 2011-08-22 12:53:04,078 [ERROR] @connection.py:383 - [Errno -2] Name or service not known Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 374, in _load_supported_resources resources_list = self.conn.request_get("/") File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 250, in request_get return self._request("GET", method) File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 210, in _request conn.request(request_type, handler, body=body, headers=self.headers) File "/usr/lib64/python2.6/httplib.py", line 914, in request self._send_request(method, url, body, headers) File "/usr/lib64/python2.6/httplib.py", line 951, in _send_request self.endheaders() File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 105, in endheaders httpslib.HTTPSConnection.endheaders(self) File "/usr/lib64/python2.6/httplib.py", line 908, in endheaders self._send_output() File "/usr/lib64/python2.6/httplib.py", line 780, in _send_output self.send(msg) File "/usr/lib64/python2.6/httplib.py", line 739, in send self.connect() File "/usr/lib64/python2.6/site-packages/M2Crypto/httpslib.py", line 169, in connect HTTPConnection.connect(self) File "/usr/lib64/python2.6/httplib.py", line 720, in connect self.timeout) File "/usr/lib64/python2.6/socket.py", line 553, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): gaierror: [Errno -2] Name or service not known 2011-08-22 12:53:04,084 [INFO] @connection.py:360 - Connection Established: host: jsefler-onprem-62candlepin.usersys.redhat.com, port: 8443, handler: /candlepin 2011-08-22 12:53:04,252 [DEBUG] @cert_sorter.py:70 - Sorting product and entitlement cert status for: 2011-08-22 12:53:04.252404 2011-08-22 12:53:04,292 [DEBUG] @cert_sorter.py:91 - Installed product IDs: ['100000000000060', '1000000000000023', '1144', '100000000000011', '100000000000010', '100000000000013', '100000000000012', '100000000000015', '27060', '68', '917571', '1', '37069', '37068', '37080', '37065', '37067', '37060', '37062', '100000000000006', '100000000000007', '100000000000004', '100000000000005', '100000000000002', '100000000000003', '100000000000000', '100000000000001', '100000000000020', '100000000000022', '100000000000009', '100000000000008', '37090', '37070'] 2011-08-22 12:53:04,293 [DEBUG] @cert_sorter.py:81 - valid entitled products: [] 2011-08-22 12:53:04,293 [DEBUG] @cert_sorter.py:82 - expired entitled products: [] 2011-08-22 12:53:04,295 [INFO] @pkgprofile.py:114 - Server does not support packages, skipping profile upload. 2011-08-22 12:53:04,295 [DEBUG] @connection.py:188 - Loading CA PEM certificates from: /etc/rhsm/ca/ 2011-08-22 12:53:04,296 [DEBUG] @connection.py:171 - Loading CA certificate: '/etc/rhsm/ca/fakamai-cp1.pem' 2011-08-22 12:53:04,296 [DEBUG] @connection.py:171 - Loading CA certificate: '/etc/rhsm/ca/jsefler-onprem-62candlepin.pem' 2011-08-22 12:53:04,297 [DEBUG] @connection.py:171 - Loading CA certificate: '/etc/rhsm/ca/redhat-uep.pem' 2011-08-22 12:53:04,298 [DEBUG] @connection.py:171 - Loading CA certificate: '/etc/rhsm/ca/candlepin-stage.pem' 2011-08-22 12:53:04,299 [DEBUG] @connection.py:194 - Using proxy: FOO:1234 2011-08-22 12:53:04,299 [DEBUG] @connection.py:209 - Making request: POST https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/subscriptions?consumer_uuid=cd3531fc-e76e-4fb3-bd0b-4789863caede&email=proxytester@redhat.com&email_locale=en-us 2011-08-22 12:53:04,330 [ERROR] @managercli.py:62 - exception caught in subscription-manager 2011-08-22 12:53:04,331 [ERROR] @managercli.py:63 - 'gaierror' object has no attribute 'code' Traceback (most recent call last): File "/usr/sbin/subscription-manager", line 78, in <module> sys.exit(abs(main() or 0)) File "/usr/sbin/subscription-manager", line 69, in main return managercli.CLI().main() File "/usr/share/rhsm/subscription_manager/managercli.py", line 1225, in main cmd.main() File "/usr/share/rhsm/subscription_manager/managercli.py", line 215, in main self._do_command() File "/usr/share/rhsm/subscription_manager/managercli.py", line 712, in _do_command if 200 <= e.code <= 210: AttributeError: 'gaierror' object has no attribute 'code'
Similarly I get the error: 'error' object has no attribute 'code' in the following scenario... [root@jsefler-onprem-62server ~]# grep proxy /etc/rhsm/rhsm.conf # an http proxy server to use proxy_hostname=auto-services.usersys.redhat.com # port for http proxy server proxy_port=3128 # user name for authenticating to an http proxy, if needed proxy_user=redhat # password for basic http proxy auth, if needed proxy_password=FOOBAR [root@jsefler-onprem-62server ~]# subscription-manager redeem --email=proxytester 'error' object has no attribute 'code' [root@jsefler-onprem-62server ~]# tail -f /var/log/rhsm/rhsm.log 2011-08-22 12:56:32,034 [INFO] @connection.py:348 - Using certificate authentication: key = /etc/pki/consumer/key.pem, cert = /etc/pki/consumer/cert.pem, ca = /etc/rhsm/ca/, insecure = False 2011-08-22 12:56:32,035 [DEBUG] @connection.py:188 - Loading CA PEM certificates from: /etc/rhsm/ca/ 2011-08-22 12:56:32,035 [DEBUG] @connection.py:171 - Loading CA certificate: '/etc/rhsm/ca/fakamai-cp1.pem' 2011-08-22 12:56:32,036 [DEBUG] @connection.py:171 - Loading CA certificate: '/etc/rhsm/ca/jsefler-onprem-62candlepin.pem' 2011-08-22 12:56:32,037 [DEBUG] @connection.py:171 - Loading CA certificate: '/etc/rhsm/ca/redhat-uep.pem' 2011-08-22 12:56:32,038 [DEBUG] @connection.py:171 - Loading CA certificate: '/etc/rhsm/ca/candlepin-stage.pem' 2011-08-22 12:56:32,038 [DEBUG] @connection.py:194 - Using proxy: auto-services.usersys.redhat.com:3128 2011-08-22 12:56:32,039 [DEBUG] @connection.py:209 - Making request: GET https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/ 2011-08-22 12:56:32,049 [WARNING] @connection.py:381 - Error fetching supported resources, this UEPConnection is likely not usable: 2011-08-22 12:56:32,049 [ERROR] @connection.py:383 - Proxy connection failed: 407 Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 374, in _load_supported_resources resources_list = self.conn.request_get("/") File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 250, in request_get return self._request("GET", method) File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 210, in _request conn.request(request_type, handler, body=body, headers=self.headers) File "/usr/lib64/python2.6/httplib.py", line 914, in request self._send_request(method, url, body, headers) File "/usr/lib64/python2.6/httplib.py", line 951, in _send_request self.endheaders() File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 105, in endheaders httpslib.HTTPSConnection.endheaders(self) File "/usr/lib64/python2.6/httplib.py", line 908, in endheaders self._send_output() File "/usr/lib64/python2.6/httplib.py", line 780, in _send_output self.send(msg) File "/usr/lib64/python2.6/httplib.py", line 739, in send self.connect() File "/usr/lib64/python2.6/site-packages/M2Crypto/httpslib.py", line 180, in connect raise socket.error, "Proxy connection failed: %d" % code error: Proxy connection failed: 407 2011-08-22 12:56:32,052 [INFO] @connection.py:360 - Connection Established: host: jsefler-onprem-62candlepin.usersys.redhat.com, port: 8443, handler: /candlepin 2011-08-22 12:56:32,150 [DEBUG] @cert_sorter.py:70 - Sorting product and entitlement cert status for: 2011-08-22 12:56:32.150275 2011-08-22 12:56:32,190 [DEBUG] @cert_sorter.py:91 - Installed product IDs: ['100000000000060', '1000000000000023', '1144', '100000000000011', '100000000000010', '100000000000013', '100000000000012', '100000000000015', '27060', '68', '917571', '1', '37069', '37068', '37080', '37065', '37067', '37060', '37062', '100000000000006', '100000000000007', '100000000000004', '100000000000005', '100000000000002', '100000000000003', '100000000000000', '100000000000001', '100000000000020', '100000000000022', '100000000000009', '100000000000008', '37090', '37070'] 2011-08-22 12:56:32,191 [DEBUG] @cert_sorter.py:81 - valid entitled products: [] 2011-08-22 12:56:32,191 [DEBUG] @cert_sorter.py:82 - expired entitled products: [] 2011-08-22 12:56:32,192 [INFO] @pkgprofile.py:114 - Server does not support packages, skipping profile upload. 2011-08-22 12:56:32,194 [DEBUG] @connection.py:188 - Loading CA PEM certificates from: /etc/rhsm/ca/ 2011-08-22 12:56:32,194 [DEBUG] @connection.py:171 - Loading CA certificate: '/etc/rhsm/ca/fakamai-cp1.pem' 2011-08-22 12:56:32,195 [DEBUG] @connection.py:171 - Loading CA certificate: '/etc/rhsm/ca/jsefler-onprem-62candlepin.pem' 2011-08-22 12:56:32,195 [DEBUG] @connection.py:171 - Loading CA certificate: '/etc/rhsm/ca/redhat-uep.pem' 2011-08-22 12:56:32,196 [DEBUG] @connection.py:171 - Loading CA certificate: '/etc/rhsm/ca/candlepin-stage.pem' 2011-08-22 12:56:32,197 [DEBUG] @connection.py:194 - Using proxy: auto-services.usersys.redhat.com:3128 2011-08-22 12:56:32,197 [DEBUG] @connection.py:209 - Making request: POST https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/subscriptions?consumer_uuid=cd3531fc-e76e-4fb3-bd0b-4789863caede&email=proxytester@redhat.com&email_locale=en-us 2011-08-22 12:56:32,224 [ERROR] @managercli.py:62 - exception caught in subscription-manager 2011-08-22 12:56:32,224 [ERROR] @managercli.py:63 - 'error' object has no attribute 'code' Traceback (most recent call last): File "/usr/sbin/subscription-manager", line 78, in <module> sys.exit(abs(main() or 0)) File "/usr/sbin/subscription-manager", line 69, in main return managercli.CLI().main() File "/usr/share/rhsm/subscription_manager/managercli.py", line 1225, in main cmd.main() File "/usr/share/rhsm/subscription_manager/managercli.py", line 215, in main self._do_command() File "/usr/share/rhsm/subscription_manager/managercli.py", line 712, in _do_command if 200 <= e.code <= 210: AttributeError: 'error' object has no attribute 'code'
Steps to reproduce, change to a bogus hostname in /etc/rhsm/rhsm.conf. The original gaierror was most likely a result of the candlepin host being unreachable at that time. Issue in error handling in subscription-manager found, working on a fix.
Fixed in subscription-manager.git: 8157ab1b9c3634cbe71607ca9dc71a1bd4bb15e4 Just had to fix the error handling to properly report non-RestlibExceptions (which don't have a code). So to be clear I believe this surfaced because the candlepin server in question was unreachable, which is easy to simulate for verifying: subscription-manager config --server.hostname bogusserver.com You should now get a proper error message and exception logged.
Moving the bug to verified.. Steps to reproduce : 1) [root@sachbeta pki]# grep proxy /etc/rhsm/rhsm.conf # an http proxy server to use proxy_hostname =auto-services.usersys.redhat.com # port for http proxy server proxy_port =3128 # user name for authenticating to an http proxy, if needed proxy_user =redhat # password for basic http proxy auth, if needed proxy_password =FOOBAR [root@sachbeta pki]# subscription-manager redeem --email=proxytester Network error, unable to connect to server. Please see /var/log/rhsm/rhsm.log for more information. 2) [root@sachbeta pki]# grep proxy /etc/rhsm/rhsm.conf # an http proxy server to use proxy_hostname =FOO # port for http proxy server proxy_port =1234 # user name for authenticating to an http proxy, if needed proxy_user = # password for basic http proxy auth, if needed proxy_password = [root@sachbeta pki]# subscription-manager redeem --email=proxytester --locale=en-us Network error, unable to connect to server. Please see /var/log/rhsm/rhsm.log for more information
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. http://rhn.redhat.com/errata/RHBA-2011-1695.html