Bug 735793 - virt-who got exception when connecting to candlepin (stage env)
Summary: virt-who got exception when connecting to candlepin (stage env)
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: virt-who
Version: 6.2
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: beta
: 6.2
Assignee: Radek Novacek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: rhsm-rhel62
TreeView+ depends on / blocked
 
Reported: 2011-09-05 12:23 UTC by Keqin Hong
Modified: 2016-12-01 00:29 UTC (History)
6 users (show)

Fixed In Version: virt-who-0.3-2.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-12-06 18:56:27 UTC


Attachments (Terms of Use)
rhsm.conf (1.22 KB, text/plain)
2011-09-05 12:56 UTC, Keqin Hong
no flags Details


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2011:1757 normal SHIPPED_LIVE new package: virt-who 2011-12-06 01:01:42 UTC

Description Keqin Hong 2011-09-05 12:23:43 UTC
Description of problem:
virt-who got exception when connecting to candlepin (stage env)

cc jomara as this may need IT to help solve.

Version-Release number of selected component (if applicable):
virt-who-0.2-1.1.el6.noarch
subscription-manager-0.96.8-1.el6.x86_64
python-rhsm-0.96.10-1.el6.noarch


How reproducible:
always

Steps to Reproduce:
1. run virt-who
# virt-who
2.
3.
  
Actual results:
Traceback (most recent call last):
  File "/usr/share/virt-who/virt-who.py", line 69, in <module>
    subscriptionManager.connect()
  File "/usr/share/virt-who/subscriptionmanager.py", line 56, in connect
    if not self.connection.ping()['result']:
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 406, in ping
    return self.conn.request_get("/status/")
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 258, in request_get
    return self._request("GET", method)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 224, in _request
    self.validateResponse(result)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 240, in validateResponse
    raise RemoteServerException(response['status'])
rhsm.connection.RemoteServerException


Expected results:


Additional info:
#/usr/lib/python2.6/site-packages/rhsm/connection.py
def ping(self, username=None, password=None):
        return self.conn.request_get("/status/")

GET /subscription/status/

{'content': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"\n       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n<head>\n  <meta http-equiv="content-type" content="text/html;charset=UTF-8" />\n  <title>404 Not Found</title>\n  <link href="/clonepin/stylesheets/scaffold.css?1315018846" media="screen" rel="stylesheet" type="text/css" />\n  <link href="/clonepin/stylesheets/errorpage.css?1315018846" media="screen" rel="stylesheet" type="text/css" />\n</head>\n<body>\n\n  <div class="dialog">\n    <h1>The page you were looking for doesn\'t exist.</h1>\n    <p>You may have mistyped the address or the page may have moved.</p>\n  </div>\n\n\n</body>\n</html>\n', 'status': 404}

Comment 2 Radek Novacek 2011-09-05 12:45:26 UTC
Are you sure that your rhsm configuration is correct? Do you have your system registered? Can you show your rhsm configuration? Maybe change prefix=/subscription to prefix=/candlepin in /etc/rhsm/rhsm.conf can help.

Comment 4 Keqin Hong 2011-09-05 12:56:26 UTC
Created attachment 521498 [details]
rhsm.conf

Comment 5 Keqin Hong 2011-09-05 12:59:07 UTC
(In reply to comment #2)
> Are you sure that your rhsm configuration is correct? Do you have your system
> registered? Can you show your rhsm configuration? Maybe change
> prefix=/subscription to prefix=/candlepin in /etc/rhsm/rhsm.conf can help.

It should be correct. For stage env, we use /subscription instead of /candlepin.
I can register/subscribe using subscription-manager.

rhsm.conf is attached https://bugzilla.redhat.com/attachment.cgi?id=521498.



GET /candlepin/status/

{'content': '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL /candlepin/status/ was not found on this server.</p>\n<hr>\n<address>Apache Server at subscription.rhn.stage.redhat.com Port 443</address>\n</body></html>\n', 'status': 404}

Comment 6 Keqin Hong 2011-09-05 13:04:17 UTC
My system is registered. Otherwise, I couldn't use virt-who.
subscription-manger has exception handling which catches the exception when getting /subscription/status/. That's why I could use subscription-manager to register/subscribe.

Comment 7 Radek Novacek 2011-09-05 13:53:48 UTC
> subscription-manger has exception handling which catches the exception when
getting /subscription/status/

Where do you get this information? I can't find it in subscription-manager code.

Comment 8 Keqin Hong 2011-09-06 03:28:49 UTC
(In reply to comment #7)
> > subscription-manger has exception handling which catches the exception when
> getting /subscription/status/
> 
> Where do you get this information? I can't find it in subscription-manager
> code.
You are right, it has no exception handling for GET /subscription/status/
 (the ping cmd).
Sorry, I meant to say it had for GET /subscription/.

#connection.py
 def _load_supported_resources(self):
        """
        Load the list of supported resources by doing a GET on the root
        of the web application we're configured to use.

        Need to handle exceptions here because sometimes UEPConnections are
        created in a state where they can't actually be used. (they get
        replaced later) If something goes wrong making this request, just
        leave the list of supported resources empty.
        """
        self.resources = {}
        try:
            resources_list = self.conn.request_get("/")
            for r in resources_list:
                self.resources[r['rel']] = r['href']
            log.debug("Server supports the following resources:")
            log.debug(self.resources)
        # Handle situations where the UEPConnection isn't actually usable:
        except Exception, e:
            log.warn("Error fetching supported resources, this "
                    "UEPConnection is likely not usable:")
            log.exception(e)

Comment 15 Radek Novacek 2011-09-07 06:44:12 UTC
Since the /status/ might not be implemented sometimes, I'll put the ping command to exception block to avoid virt-who to fail.

Comment 16 Radek Novacek 2011-09-07 07:22:30 UTC
Fixed in virt-who-0.3-2.el6.

Comment 18 Keqin Hong 2011-09-07 11:30:28 UTC
Verified on virt-who-0.3-2.el6. PASS

Steps:
1. enable virt-who debug option in /etc/sysconfig/
VIRTWHO_DEBUG=1
2. # service virt-who restart

virt-who exited normally.

Comment 19 errata-xmlrpc 2011-12-06 18:56:27 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/RHEA-2011-1757.html


Note You need to log in before you can comment on or make changes to this bug.