Bug 822965

Summary: subscription-manager release does not work with proxies
Product: Red Hat Enterprise Linux 6 Reporter: J.C. Molet <jmolet>
Component: python-rhsmAssignee: Chris Duryee <cduryee>
Status: CLOSED ERRATA QA Contact: Entitlement Bugs <entitlement-bugs>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.3CC: cduryee, jsefler, mstead, syeghiay
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 833537 (view as bug list) Environment:
Last Closed: 2012-06-20 12:58:12 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: 738066, 826592, 833537    

Description J.C. Molet 2012-05-18 16:03:33 UTC
Description of problem:
I cannot use subscription-manager release when on a proxy.

Version-Release number of selected component (if applicable):
subscription-manager-0.99.18-1.git.1.52e1aeb.el6.x86_64
subscription-manager-migration-data-1.12.1.8-1.git.0.c91a246.el6.noarch
subscription-manager-gnome-0.99.18-1.git.1.52e1aeb.el6.x86_64
subscription-manager-migration-0.99.18-1.git.1.52e1aeb.el6.x86_64
subscription-manager-firstboot-0.99.18-1.git.1.52e1aeb.el6.x86_64
python-rhsm-0.99.11-1.git.0.2de18a9.el6.noarch


How reproducible:
always

Steps to Reproduce:
1. Set up a rhel 6.3 system using rhsm from the rhel 6.3 branch
2. set your rhsm.conf file thusly:

[root@jmolet-vm0 yum.repos.d]# grep . /etc/rhsm/rhsm.conf | grep -v ^#
[server]
hostname=subscription.rhn.stage.redhat.com
prefix=/subscription
port=443
insecure=0
proxy_hostname=auto-services.usersys.redhat.com
proxy_port=3129
proxy_user=
proxy_password=

(and or use your favorite proxy server and candlepin server with releases)

3. Make sure /etc/pki/product/ is populated with the proper rhel server pem (69.pem)
4. # subscription-manager register --user=stage_test_12 --password=redhat
5. # subscription-manager subscribe --auto
6. # subscription-manager release --list
  
Actual results:
[root@jmolet-vm0 product]# subscription-manager register --user=stage_test_12 --password=redhat
The system has been registered with id: 81d3ac92-e15d-4472-b436-8ede0409b027 
[root@jmolet-vm0 product]# ls -a
.  ..  69.pem
[root@jmolet-vm0 product]# subscription-manager subscribe --auto
Installed Product Current Status:
Product Name:         	Red Hat Enterprise Linux Server
Status:               	Subscribed               

[root@jmolet-vm0 product]# subscription-manager release --list
unknown URL type: ///content/dist/rhel/server/6//listing

Expected results:
# subscription-manager release --list gives me a list of releases.

Additional info:
- This happens when you use either a proxy that does or does not require auth.
- This only happens when you set the proxy in rhsm.conf, and does not happen when specify the proxy via command-line args

Comment 1 John Sefler 2012-05-18 16:52:45 UTC
[root@qe-blade-06 ~]# tail -f /var/log/rhsm/rhsm.log

2012-05-18 12:50:30,649 [DEBUG]  @connection.py:147 - ContectConnection
2012-05-18 12:50:30,653 [INFO]  @connection.py:484 - Using certificate authentication: key = /etc/pki/consumer/key.pem, cert = /etc/pki/consumer/cert.pem, ca = /etc/rhsm/ca/, insecure = False
2012-05-18 12:50:30,653 [INFO]  @connection.py:495 - Connection Built: host: subscription.rhn.stage.redhat.com, port: 443, handler: /subscription
2012-05-18 12:50:30,789 [DEBUG]  @cert_sorter.py:107 - Sorting product and entitlement cert status for: 2012-05-18 16:50:30.789585+00:00
2012-05-18 12:50:30,791 [DEBUG]  @cert_sorter.py:160 - Installed product IDs: ['69']
2012-05-18 12:50:30,830 [DEBUG]  @cert_sorter.py:176 - Checking certificate: 2164116074142248493
2012-05-18 12:50:30,835 [DEBUG]  @cert_sorter.py:287 -   system has 2 sockets, 8 covered by entitlement
2012-05-18 12:50:30,867 [DEBUG]  @cert_sorter.py:113 - valid entitled products: ['69']
2012-05-18 12:50:30,867 [DEBUG]  @cert_sorter.py:114 - expired entitled products: []
2012-05-18 12:50:30,867 [DEBUG]  @cert_sorter.py:115 - partially entitled products: []
2012-05-18 12:50:30,867 [DEBUG]  @cert_sorter.py:116 - unentitled products: []
2012-05-18 12:50:30,867 [DEBUG]  @cert_sorter.py:117 - future products: []
2012-05-18 12:50:30,867 [DEBUG]  @cert_sorter.py:118 - partial stacks: []
2012-05-18 12:50:30,867 [DEBUG]  @cert_sorter.py:119 - valid stacks: []
2012-05-18 12:50:30,868 [DEBUG]  @cert_sorter.py:107 - Sorting product and entitlement cert status for: 2012-05-18 16:50:30.868624+00:00
2012-05-18 12:50:30,870 [DEBUG]  @cert_sorter.py:160 - Installed product IDs: ['69']
2012-05-18 12:50:30,907 [DEBUG]  @cert_sorter.py:176 - Checking certificate: 2164116074142248493
2012-05-18 12:50:30,908 [DEBUG]  @cert_sorter.py:287 -   system has 2 sockets, 8 covered by entitlement
2012-05-18 12:50:30,940 [DEBUG]  @cert_sorter.py:113 - valid entitled products: ['69']
2012-05-18 12:50:30,940 [DEBUG]  @cert_sorter.py:114 - expired entitled products: []
2012-05-18 12:50:30,940 [DEBUG]  @cert_sorter.py:115 - partially entitled products: []
2012-05-18 12:50:30,940 [DEBUG]  @cert_sorter.py:116 - unentitled products: []
2012-05-18 12:50:30,940 [DEBUG]  @cert_sorter.py:117 - future products: []
2012-05-18 12:50:30,940 [DEBUG]  @cert_sorter.py:118 - partial stacks: []
2012-05-18 12:50:30,940 [DEBUG]  @cert_sorter.py:119 - valid stacks: []
2012-05-18 12:50:31,853 [INFO]  @release.py:138 - No matching products with RHEL product tags found
2012-05-18 12:50:31,853 [INFO]  @release.py:138 - No matching products with RHEL product tags found
2012-05-18 12:50:31,854 [INFO]  @release.py:138 - No matching products with RHEL product tags found
2012-05-18 12:50:31,854 [DEBUG]  @connection.py:195 - Loading CA certificate: '/etc/pki/entitlement/2164116074142248493.pem'
2012-05-18 12:50:31,856 [DEBUG]  @connection.py:171 - Using proxy: auto-services.usersys.redhat.com:3128
2012-05-18 12:50:31,857 [ERROR]  @managercli.py:101 - exception caught in subscription-manager
2012-05-18 12:50:31,857 [ERROR]  @managercli.py:102 - unknown URL type: ///content/dist/rhel/server/6//listing
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 79, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/sbin/subscription-manager", line 70, in main
    return managercli.CLI().main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 1772, in main
    return cmd.main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 280, in main
    return_code = self._do_command()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 1046, in _do_command
    releases = self.release_backend.get_releases()
  File "/usr/share/rhsm/subscription_manager/release.py", line 98, in get_releases
    data = self.content_connection.get_versions(listing_path)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 213, in get_versions
    results = self._request("GET", handler, body="")
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 181, in _request
    conn.request("GET", handler, body="", headers={"Content-Length": "0"})
  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 931, in _send_request
    self.putrequest(method, url, **skips)
  File "/usr/lib64/python2.6/site-packages/M2Crypto/httpslib.py", line 150, in putrequest
    raise ValueError, "unknown URL type: %s" % url
ValueError: unknown URL type: ///content/dist/rhel/server/6//listing

Comment 2 Chris Duryee 2012-05-18 19:02:47 UTC
23dc08e python-rhsm rhel6.3 0.99.12+

Comment 5 John Sefler 2012-05-20 03:50:24 UTC
Still having trouble after testing with changes in comment 2.

I no longer get the unknown URL type: ///content/dist/rhel/server/6//listing.
Now I get an empty list even though my installed RHEL product is Subscribed.

Moving back to ASSIGNED/FailedQA

Comment 6 Chris Duryee 2012-05-21 15:23:57 UTC
(In reply to comment #5)
> Still having trouble after testing with changes in comment 2.
> 
> I no longer get the unknown URL type: ///content/dist/rhel/server/6//listing.
> Now I get an empty list even though my installed RHEL product is Subscribed.
> 
> Moving back to ASSIGNED/FailedQA

63d0e38c RHEL6.3 0.99.12+

(also in master but waiting for a pull)

Comment 8 J.C. Molet 2012-05-22 13:50:47 UTC
subscription-manager-gnome-0.99.18-1.git.1.52e1aeb.el6.x86_64
subscription-manager-firstboot-0.99.18-1.git.1.52e1aeb.el6.x86_64
python-rhsm-0.99.11-1.git.2.63d0e38.el6.noarch
subscription-manager-migration-data-1.12.1.8-1.git.0.c91a246.el6.noarch
subscription-manager-migration-0.99.18-1.git.1.52e1aeb.el6.x86_64
subscription-manager-0.99.18-1.git.1.52e1aeb.el6.x86_64

[root@jmolet-vm0 product]# subscription-manager unregister
This system is currently not registered.
[root@jmolet-vm0 product]# subscription-manager register --username=stage_test_12 --password=redhat
The system has been registered with id: 9eb53ba1-40ad-4287-8cae-001de1d0ab05 
[root@jmolet-vm0 product]# subscription-manager subscribe --auto
Installed Product Current Status:
Product Name:         	Red Hat Enterprise Linux Server
Status:               	Subscribed               
[root@jmolet-vm0 ~]# subscription-manager release --list
6.1
6.2
6Server

No messages in /var/log/rhsm/rhsm.log

This seems to work on the latest python-rhsm in the rhel-6.3 branch.  Waiting for this to make the rhel 6.3 compose before I mark it verified.

Comment 11 John Sefler 2012-05-23 15:09:08 UTC
Verifying Version...
[root@kvm-guest-02 ~]# rpm -q python-rhsm subscription-manager
python-rhsm-0.99.12-1.el6.noarch
subscription-manager-0.99.19-1.el6.x86_64


[root@kvm-guest-02 ~]# subscription-manager config --server.hostname subscription.rhn.stage.redhat.com
[root@kvm-guest-02 ~]# subscription-manager config --server.proxy_hostname auto-services.usersys.redhat.com --server.proxy_port 3129
[root@kvm-guest-02 ~]# 
[root@kvm-guest-02 ~]# subscription-manager register --username stage_test_12 --password redhat --autosubscribe
The system has been registered with id: e3e3064f-852e-4c60-a1d6-a3a01aa40206 
Installed Product Current Status:
Product Name:         	Red Hat Enterprise Linux Server
Status:               	Subscribed               

[root@kvm-guest-02 ~]# subscription-manager release --list
6.1
6.2
6Server
[root@kvm-guest-02 ~]# 

^^^ VERIFIED: We now get the expected release list even when configured to communicate through a proxy server.

Comment 12 John Sefler 2012-05-23 15:39:34 UTC
Additional Verification info:
This shows the traffic through the proxy server during the call to subscription-manager release --list ...

[root@auto-services ~]# tail -f /var/log/tinyproxy.log 

CONNECT   May 23 16:34:54 [6128]: Connect (file descriptor 7): kvm-guest-02.rhts.eng.bos.redhat.com [10.16.69.149]
CONNECT   May 23 16:34:54 [6128]: Request (file descriptor 7): CONNECT cdn.rcm-qa.redhat.com:443 HTTP/1.1
INFO      May 23 16:34:54 [6128]: No proxy for cdn.rcm-qa.redhat.com
CONNECT   May 23 16:34:54 [6128]: Established connection to host "cdn.rcm-qa.redhat.com" using file descriptor 25.
INFO      May 23 16:34:54 [6128]: Not sending client headers to remote machine
INFO      May 23 16:34:55 [6128]: Closed connection between local client (fd:7) and remote client (fd:25)

Comment 14 errata-xmlrpc 2012-06-20 12:58:12 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.

http://rhn.redhat.com/errata/RHBA-2012-0805.html