Bug 1400719

Summary: AttributeError: 'ContentConnection' object has no attribute 'proxy_host'
Product: Red Hat Enterprise Linux 6 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: William Poteat <wpoteat>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: high Docs Contact:
Priority: high    
Version: 6.9CC: brian.murrell, csnyder, redakkan, skallesh, vrjain, wpoteat
Target Milestone: rcKeywords: EasyFix, Regression, 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: 2017-03-21 10:57:40 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:
Bug Depends On:    
Bug Blocks: 1306058, 1401884    

Description John Sefler 2016-12-01 22:59:47 UTC
Description of problem:
When attempting to list available releases after attaching a RHEL subscription, this traceback is thrown when using a proxy, but works fine when not using a proxy.

[root@jsefler-rhel6 ~]# tail -f /var/log/rhsm/rhsm.log
2016-12-01 17:35:53,369 [DEBUG] subscription-manager:11858:MainThread @connection.py:309 - Loading CA certificate: '/etc/pki/entitlement/1595989299943042860.pem'
2016-12-01 17:35:53,370 [DEBUG] subscription-manager:11858:MainThread @connection.py:281 - Using proxy: auto-services.usersys.redhat.com:3128
2016-12-01 17:35:53,370 [ERROR] subscription-manager:11858:MainThread @managercli.py:177 - exception caught in subscription-manager
2016-12-01 17:35:53,370 [ERROR] subscription-manager:11858:MainThread @managercli.py:178 - 'ContentConnection' object has no attribute 'proxy_host'
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 81, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/sbin/subscription-manager", line 72, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib/python2.6/site-packages/subscription_manager/managercli.py", line 2768, in main
    return CLI.main(self)
  File "/usr/lib/python2.6/site-packages/subscription_manager/cli.py", line 160, in main
    return cmd.main()
  File "/usr/lib/python2.6/site-packages/subscription_manager/managercli.py", line 537, in main
    return_code = self._do_command()
  File "/usr/lib/python2.6/site-packages/subscription_manager/managercli.py", line 1458, in _do_command
    releases = self.release_backend.get_releases()
  File "/usr/lib/python2.6/site-packages/subscription_manager/release.py", line 48, in get_releases
    return provider.get_releases()
  File "/usr/lib/python2.6/site-packages/subscription_manager/release.py", line 125, in get_releases
    data = self.content_connection.get_versions(listing_path)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 327, in get_versions
    results = self._request("GET", handler, body="")
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 285, in _request
    conn = httplib.HTTPSConnection(self.proxy_host, self.proxy_port, context=context, timeout=self.timeout)
AttributeError: 'ContentConnection' object has no attribute 'proxy_host'




Version-Release number of selected component (if applicable):
[root@jsefler-rhel6 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.51.20-1
subscription management rules: 5.15.1
subscription-manager: 1.18.5-1.el6
python-rhsm: 1.18.5-1.el6


How reproducible:


Steps to Reproduce:
[root@jsefler-rhel6 ~]# subscription-manager config --server.proxy_hostname=auto-services.usersys.redhat.com --server.proxy_port=3129
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# subscription-manager register --auto-attach --serverurl=subscription.rhsm.stage.redhat.com
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: stage_auto_testuser1
Password: 
The system has been registered with ID: 130d5672-aa98-49e0-91c4-c41692d5c9e6 

Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

[root@jsefler-rhel6 ~]# subscription-manager release --list
'ContentConnection' object has no attribute 'proxy_host'
[root@jsefler-rhel6 ~]# 

BANG! ContentConnection' object has no attribute 'proxy_host'  That was not expected.
Realize that the proxy setting was valid and traffic successfully flowed through the proxy during the registration step.  Now when I remove the proxy confguration, you'll see that the request is successful...

 [root@jsefler-rhel6 ~]# subscription-manager config --server.proxy_hostname="" --server.proxy_port="" --server.proxy_user="" --server.proxy_password=""
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# subscription-manager release --list
+-------------------------------------------+
          Available Releases
+-------------------------------------------+
6.1
6.2
6.3
6.4
6.5
6.6
6.7
6.8
6Server
[root@jsefler-rhel6 ~]# 

WORKS! with no proxy, but....

[root@jsefler-rhel6 ~]# subscription-manager release --list --proxy=auto-services.usersys.redhat.com:3129
'ContentConnection' object has no attribute 'proxy_host'
[root@jsefler-rhel6 ~]# 
[root@jsefler-rhel6 ~]# subscription-manager release --list --proxy=auto-services.usersys.redhat.com:3128 --proxyuser=redhat --proxypassword=redhat
'ContentConnection' object has no attribute 'proxy_host'
[root@jsefler-rhel6 ~]# 

FAILS! with two different proxys (both auth and no-auth)




Actual results:
'ContentConnection' object has no attribute 'proxy_host'

Expected results:
+-------------------------------------------+
          Available Releases
+-------------------------------------------+
6.1
6.2
6.3
6.4
6.5
6.6
6.7
6.8
6Server


Additional info:

Comment 3 Chris Snyder 2016-12-08 23:14:09 UTC
Moving this to POST as the fix has been merged upstream.

Comment 5 Rehana 2016-12-12 11:52:13 UTC
Reproducing the failure:
=========================

# subscription-manager config --server.proxy_hostname=auto-services.usersys.redhat.com --server.proxy_port=3129

# subscription-manager register --auto-attach --serverurl=subscription.rhsm.stage.redhat.com
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: <username>
Password: 
The system has been registered with ID: 38c23c0f-46e2-47ec-be47-fb363135aaff 

Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

# subscription-manager release --list
'ContentConnection' object has no attribute 'proxy_host'
# subscription-manager release --list --proxy=auto-services.usersys.redhat.com:3128 --proxyuser=redhat --proxypassword=redhat
'ContentConnection' object has no attribute 'proxy_host'

Verifying with : 

#subscription management server: 0.9.51.20-1
subscription management rules: 5.15.1
subscription-manager: 1.18.6-1.el6
python-rhsm: 1.18.6-1.el6

# subscription-manager config --server.proxy_hostname=auto-services.usersys.redhat.com --server.proxy_port=3129

# subscription-manager register --auto-attach --serverurl=subscription.rhsm.stage.redhat.com
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: username
Password: 
The system has been registered with ID: ebf6c00a-c93d-41f3-a97c-7711ce9066f3 

Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

# subscription-manager release --list
+-------------------------------------------+
          Available Releases
+-------------------------------------------+
6.1
6.2
6.3
6.4
6.5
6.6
6.7
6.8
6Server
# subscription-manager release --list --proxy=auto-services.usersys.redhat.com:3128 --proxyuser=redhat --proxypassword=redhat
+-------------------------------------------+
          Available Releases
+-------------------------------------------+
6.1
6.2
6.3
6.4
6.5
6.6
6.7
6.8
6Server


# subscription-manager config --server.proxy_hostname="" --server.proxy_port="" --server.proxy_user="" --server.proxy_password=""

# subscription-manager release --list
+-------------------------------------------+
          Available Releases
+-------------------------------------------+
6.1
6.2
6.3
6.4
6.5
6.6
6.7
6.8
6Server

Observed that now release list works with auth and no-auth proxy. Also demonstrated that with no-proxy release list works as earlier. 

Marking as Verified!!

Comment 6 Kevin Howell 2017-01-03 15:40:57 UTC
*** Bug 1409004 has been marked as a duplicate of this bug. ***

Comment 8 errata-xmlrpc 2017-03-21 10:57:40 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-2017-0698.html