Bug 1570558

Summary: traceback on console when tried to run disable auto-attach with invalid proxy
Product: Red Hat Enterprise Linux 7 Reporter: Shwetha Kallesh <skallesh>
Component: subscription-managerAssignee: Jiri Hnidek <jhnidek>
Status: CLOSED WONTFIX QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: low Docs Contact:
Priority: low    
Version: 7.6CC: jhnidek, jsefler, khowell, redakkan
Target Milestone: rcKeywords: 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: 2021-02-09 15:09:51 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:

Description Shwetha Kallesh 2018-04-23 08:48:17 UTC
Description of problem:
traceback on console when tried to run disable auto-attach with invalid proxy

Version-Release number of selected component (if applicable):
[root@hp-dl380pgen8-02-vm-4 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription-manager: 1.21.2-3.git.48.3892c60.el7


How reproducible:


Steps to Reproduce:

[root@hp-dl380pgen8-02-vm-4 ~]# cat /etc/rhsm/rhsm.conf | grep proxy
# 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 = bad-username
# password for basic http proxy auth, if needed
proxy_password = bad-username
# host/domain suffix blacklist for proxy, if needed
no_proxy =


[root@hp-dl380pgen8-02-vm-4 ~]# subscription-manager auto-attach --disable
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 9, in <module>
    load_entry_point('subscription-manager==1.21.2', 'console_scripts', 'subscription-manager')()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/scripts/subscription_manager.py", line 85, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 2662, in main
    ret = CLI.main(self)
  File "/usr/lib64/python2.7/site-packages/subscription_manager/cli.py", line 183, in main
    return cmd.main()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 498, in main
    return_code = self._do_command()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 838, in _do_command
    self._toggle(self.options.enable or False)
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 819, in _toggle
    self.cp.updateConsumer(self.uuid, autoheal=autoheal)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 1051, in updateConsumer
    ret = self.conn.request_put(method, params)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 702, in request_put
    return self._request("PUT", method, params, headers=headers)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 719, in _request
    info=info, headers=headers)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 557, in _request
    conn.request(request_type, handler, body=body, headers=final_headers)
  File "/usr/lib64/python2.7/httplib.py", line 1041, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib64/python2.7/httplib.py", line 1075, in _send_request
    self.endheaders(body)
  File "/usr/lib64/python2.7/httplib.py", line 1037, in endheaders
    self._send_output(message_body)
  File "/usr/lib64/python2.7/httplib.py", line 881, in _send_output
    self.send(msg)
  File "/usr/lib64/python2.7/httplib.py", line 843, in send
    self.connect()
  File "/usr/lib64/python2.7/httplib.py", line 1251, in connect
    HTTPConnection.connect(self)
  File "/usr/lib64/python2.7/httplib.py", line 827, in connect
    self._tunnel()
  File "/usr/lib64/python2.7/httplib.py", line 809, in _tunnel
    message.strip()))
socket.error: Tunnel connection failed: 407 Proxy Authentication Required


Actual results:
traceback 
Expected results:
Proxy error, unable to connect to proxy server.


Additional info:

Comment 2 Kevin Howell 2018-04-23 14:31:52 UTC
Triaging low, low since it's an ugly error, but otherwise no harm.

Dev, we suggest a git bisect to determine where this change was introduced.

Comment 4 Shwetha Kallesh 2020-07-29 11:05:10 UTC
Still see the failure 

[root@hpe-dl380pgen8-02-vm-2 ~]# subscription-manager version
subscription-manager: 1.27.11-1.el8


[root@hpe-dl380pgen8-02-vm-2 ~]# cat /etc/rhsm/rhsm.conf | grep proxy
# an http proxy server to use
proxy_hostname =auto-services.usersys.redhat.com
# The scheme to use for the proxy when updating repo definitions, if needed
proxy_scheme = http
# port for http proxy server
proxy_port = 3127
# user name for authenticating to an http proxy, if needed
proxy_user =redhatiq
# password for basic http proxy auth, if needed
proxy_password =redhat
# host/domain suffix blacklist for proxy, if needed
no_proxy = 
[root@hpe-dl380pgen8-02-vm-2 ~]# subscription-manager auto-attach --disable
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 704, in _request
    conn.request(request_type, handler, body=body, headers=final_headers)
  File "/usr/lib64/python3.6/http/client.py", line 1254, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1300, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1249, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1036, in _send_output
    self.send(msg)
  File "/usr/lib64/python3.6/http/client.py", line 974, in send
    self.connect()
  File "/usr/lib64/python3.6/http/client.py", line 1414, in connect
    super().connect()
  File "/usr/lib64/python3.6/http/client.py", line 950, in connect
    self._tunnel()
  File "/usr/lib64/python3.6/http/client.py", line 929, in _tunnel
    message.strip()))
OSError: Tunnel connection failed: 407 Proxy Authentication Required

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 11, in <module>
    load_entry_point('subscription-manager==1.27.11', 'console_scripts', 'subscription-manager')()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/scripts/subscription_manager.py", line 87, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 3253, in main
    ret = CLI.main(self)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cli.py", line 183, in main
    return cmd.main()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 546, in main
    return_code = self._do_command()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 1268, in _do_command
    self._toggle(self.options.enable or False)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 1249, in _toggle
    self.cp.updateConsumer(self.uuid, autoheal=autoheal)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 1163, in updateConsumer
    ret = self.conn.request_put(method, params)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 889, in request_put
    return self._request("PUT", method, params, headers=headers)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 906, in _request
    info=info, headers=headers, cert_key_pairs=cert_key_pairs)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 740, in _request
    raise ProxyException(err)
rhsm.connection.ProxyException: Tunnel connection failed: 407 Proxy Authentication Required

Comment 6 Rehana 2021-02-09 15:09:51 UTC
We have improved the experience in RHEL 8 https://bugzilla.redhat.com/show_bug.cgi?id=1861255 , bringing those change to RHEL 7 might not be possible due to its current release cycle. 

Hence closing the bug as wont fix in RHEL 7. 

thanks,
Rehana