Bug 919255

Summary: negative proxy testing against subscription-manager repos --list
Product: Red Hat Enterprise Linux 7 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Alex Wood <awood>
Status: CLOSED CURRENTRELEASE QA Contact: IDM QE LIST <seceng-idm-qe-list>
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.0CC: awood, skallesh
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 10:59:44 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: 863175    

Description John Sefler 2013-03-07 23:00:31 UTC
Description of problem:
To fix bug 906642, the subscription-manager proxy options have been enabled for the repos module.

While executing some negative proxy tests against the repos module, stdout is exposing these errors that other modules appear to catch.
  [Errno -2] Name or service not known
  Proxy connection failed: 407
  [Errno 111] Connection refused

Version-Release number of selected component (if applicable):
[root@jsefler-7 ~]# rpm -q subscription-manager python-rhsm
subscription-manager-1.8.3-1.git.141.da518e0.el7.x86_64
python-rhsm-1.8.6-1.git.1.8a7996b.el7.x86_64



Steps to Reproduce:
register and attach a subscription

Case 1:
[root@jsefler-7 ~]# subscription-manager release --list --proxy=foo
Network error, unable to connect to server.
Please see /var/log/rhsm/rhsm.log for more information.
[root@jsefler-7 ~]# subscription-manager repos --list --proxy=foo
[Errno -2] Name or service not known       <=============== UNEXPECTED RESULTS
Network error, unable to connect to server.
Please see /var/log/rhsm/rhsm.log for more information.

Case 2:
[root@jsefler-7 ~]# subscription-manager release --list --proxy=auto-services.usersys.redhat.com:3128 --proxyuser=redhat --proxypassword=bad-password
Network error, unable to connect to server.
Please see /var/log/rhsm/rhsm.log for more information.
[root@jsefler-7 ~]# subscription-manager repos --list --proxy=auto-services.usersys.redhat.com:3128 --proxyuser=redhat --proxypassword=bad-password
Proxy connection failed: 407               <=============== UNEXPECTED RESULTS
Network error, unable to connect to server.
Please see /var/log/rhsm/rhsm.log for more information.
[root@jsefler-7 ~]# 

Case 3:
[root@jsefler-7 ~]# subscription-manager release --list --proxy=auto-services.usersys.redhat.com:31290
Network error, unable to connect to server.
Please see /var/log/rhsm/rhsm.log for more information.
[root@jsefler-7 ~]# subscription-manager repos --list --proxy=auto-services.usersys.redhat.com:31290
[Errno 111] Connection refused               <=============== UNEXPECTED RESULTS
Network error, unable to connect to server.
Please see /var/log/rhsm/rhsm.log for more information.
[root@jsefler-7 ~]# 



Additional info:

Case 1:
2013-03-07 17:49:53,843 [DEBUG]  @connection.py:400 - Using proxy: foo:3128
2013-03-07 17:49:53,844 [DEBUG]  @connection.py:415 - Making request: GET https://jsefler-f14-candlepin.usersys.redhat.com:8443/candlepin/consumers/0ee64a22-48e6-4c0c-8d6e-40e6f5185a3e/release
2013-03-07 17:49:53,847 [ERROR]  @managercli.py:143 - exception caught in subscription-manager
2013-03-07 17:49:53,849 [ERROR]  @managercli.py:144 - [Errno -2] Name or service not known
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 87, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/sbin/subscription-manager", line 78, in main
    return managercli.ManagerCLI().main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 2167, in main
    return CLI.main(self)
  File "/usr/share/rhsm/subscription_manager/cli.py", line 160, in main
    return cmd.main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 472, in main
    return_code = self._do_command()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 1796, in _do_command
    repos = rl.get_repos()
  File "/usr/share/rhsm/subscription_manager/repolib.py", line 48, in get_repos
    action = UpdateAction(uep=self.uep)
  File "/usr/share/rhsm/subscription_manager/repolib.py", line 108, in __init__
    result = self.uep.getRelease(self.consumer_uuid)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 868, in getRelease
    results = self.conn.request_get(method)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 481, in request_get
    return self._request("GET", method)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 422, in _request
    conn.request(request_type, handler, body=body, headers=headers)
  File "/usr/lib64/python2.7/httplib.py", line 958, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib64/python2.7/httplib.py", line 992, in _send_request
    self.endheaders(body)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 174, in endheaders
    httpslib.HTTPSConnection.endheaders(self)
  File "/usr/lib64/python2.7/httplib.py", line 954, in endheaders
    self._send_output(message_body)
  File "/usr/lib64/python2.7/httplib.py", line 814, in _send_output
    self.send(msg)
  File "/usr/lib64/python2.7/httplib.py", line 776, in send
    self.connect()
  File "/usr/lib64/python2.7/site-packages/M2Crypto/httpslib.py", line 195, in connect
    HTTPConnection.connect(self)
  File "/usr/lib64/python2.7/httplib.py", line 757, in connect
    self.timeout, self.source_address)
  File "/usr/lib64/python2.7/socket.py", line 553, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
gaierror: [Errno -2] Name or service not known



Case 2:
2013-03-07 17:51:57,985 [DEBUG]  @connection.py:400 - Using proxy: auto-services.usersys.redhat.com:3128
2013-03-07 17:51:57,986 [DEBUG]  @connection.py:415 - Making request: GET https://jsefler-f14-candlepin.usersys.redhat.com:8443/candlepin/consumers/0ee64a22-48e6-4c0c-8d6e-40e6f5185a3e/release
2013-03-07 17:51:58,000 [ERROR]  @managercli.py:143 - exception caught in subscription-manager
2013-03-07 17:51:58,000 [ERROR]  @managercli.py:144 - Proxy connection failed: 407
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 87, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/sbin/subscription-manager", line 78, in main
    return managercli.ManagerCLI().main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 2167, in main
    return CLI.main(self)
  File "/usr/share/rhsm/subscription_manager/cli.py", line 160, in main
    return cmd.main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 472, in main
    return_code = self._do_command()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 1796, in _do_command
    repos = rl.get_repos()
  File "/usr/share/rhsm/subscription_manager/repolib.py", line 48, in get_repos
    action = UpdateAction(uep=self.uep)
  File "/usr/share/rhsm/subscription_manager/repolib.py", line 108, in __init__
    result = self.uep.getRelease(self.consumer_uuid)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 868, in getRelease
    results = self.conn.request_get(method)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 481, in request_get
    return self._request("GET", method)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 422, in _request
    conn.request(request_type, handler, body=body, headers=headers)
  File "/usr/lib64/python2.7/httplib.py", line 958, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib64/python2.7/httplib.py", line 992, in _send_request
    self.endheaders(body)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 174, in endheaders
    httpslib.HTTPSConnection.endheaders(self)
  File "/usr/lib64/python2.7/httplib.py", line 954, in endheaders
    self._send_output(message_body)
  File "/usr/lib64/python2.7/httplib.py", line 814, in _send_output
    self.send(msg)
  File "/usr/lib64/python2.7/httplib.py", line 776, in send
    self.connect()
  File "/usr/lib64/python2.7/site-packages/M2Crypto/httpslib.py", line 206, in connect
    raise socket.error, "Proxy connection failed: %d" % code
error: Proxy connection failed: 407



Case 3:
2013-03-07 17:54:09,876 [DEBUG]  @connection.py:400 - Using proxy: auto-services.usersys.redhat.com:31290
2013-03-07 17:54:09,876 [DEBUG]  @connection.py:415 - Making request: GET https://jsefler-f14-candlepin.usersys.redhat.com:8443/candlepin/consumers/0ee64a22-48e6-4c0c-8d6e-40e6f5185a3e/release
2013-03-07 17:54:09,879 [ERROR]  @managercli.py:143 - exception caught in subscription-manager
2013-03-07 17:54:09,879 [ERROR]  @managercli.py:144 - [Errno 111] Connection refused
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 87, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/sbin/subscription-manager", line 78, in main
    return managercli.ManagerCLI().main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 2167, in main
    return CLI.main(self)
  File "/usr/share/rhsm/subscription_manager/cli.py", line 160, in main
    return cmd.main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 472, in main
    return_code = self._do_command()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 1796, in _do_command
    repos = rl.get_repos()
  File "/usr/share/rhsm/subscription_manager/repolib.py", line 48, in get_repos
    action = UpdateAction(uep=self.uep)
  File "/usr/share/rhsm/subscription_manager/repolib.py", line 108, in __init__
    result = self.uep.getRelease(self.consumer_uuid)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 868, in getRelease
    results = self.conn.request_get(method)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 481, in request_get
    return self._request("GET", method)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 422, in _request
    conn.request(request_type, handler, body=body, headers=headers)
  File "/usr/lib64/python2.7/httplib.py", line 958, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib64/python2.7/httplib.py", line 992, in _send_request
    self.endheaders(body)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 174, in endheaders
    httpslib.HTTPSConnection.endheaders(self)
  File "/usr/lib64/python2.7/httplib.py", line 954, in endheaders
    self._send_output(message_body)
  File "/usr/lib64/python2.7/httplib.py", line 814, in _send_output
    self.send(msg)
  File "/usr/lib64/python2.7/httplib.py", line 776, in send
    self.connect()
  File "/usr/lib64/python2.7/site-packages/M2Crypto/httpslib.py", line 195, in connect
    HTTPConnection.connect(self)
  File "/usr/lib64/python2.7/httplib.py", line 757, in connect
    self.timeout, self.source_address)
  File "/usr/lib64/python2.7/socket.py", line 571, in create_connection
    raise err
error: [Errno 111] Connection refused

Comment 1 Alex Wood 2013-03-26 13:24:06 UTC
commit 8e74e00813b42b461bebc1788196cf104a021411
Author: Alex Wood <awood>
Date:   Mon Mar 25 15:02:16 2013 -0400

    919255: Remove extraneous print statement.

Comment 2 Shwetha Kallesh 2013-04-08 05:46:18 UTC
Verified!!

Version:
[root@localhost ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.8.1-1
subscription-manager: 1.8.5-1.el7
python-rhsm: 1.8.8-1.el7



[root@localhost ~]# subscription-manager repos --list --proxy=foo
Network error, unable to connect to server.
Please see /var/log/rhsm/rhsm.log for more information.

[root@localhost ~]# subscription-manager repos --list --proxy=10.65.193.76:3128 --proxyuser=redhat --proxypassword=bad-password
Network error, unable to connect to server.
Please see /var/log/rhsm/rhsm.log for more information.

[root@localhost ~]# subscription-manager repos --list --proxy=10.65.193.76:31290
Network error, unable to connect to server.
Please see /var/log/rhsm/rhsm.log for more information.

Comment 3 Ludek Smid 2014-06-13 10:59:44 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.