Bug 790954

Summary: rhn-migrate-classic-to-rhsm throws traceback when servers are unavailable
Product: Red Hat Enterprise Linux 5 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Alex Wood <awood>
Status: CLOSED CURRENTRELEASE QA Contact: Entitlement Bugs <entitlement-bugs>
Severity: low Docs Contact:
Priority: unspecified    
Version: 5.8CC: awood, fsharath
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
No documentation needed.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-12-10 21:42:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 715031, 771748, 807971    

Description John Sefler 2012-02-15 19:27:11 UTC
Description of problem:
I'm not sure how easy this is to reproduce, but during the course of testing against the stage environment while the candlepin servers are in the midst of a refresh, rhn-migrate-classic-to-rhsm will throw tracebacks.  While we do not expect rhn-migrate-classic-to-rhsm to succeed in this situation, it should fail more gracefully than a traceback.


Version-Release number of selected component (if applicable):
rhsm.connection.RemoteServerException[root@qe-blade-04 ~]# rpm -q subscription-manager-migration
subscription-manager-migration-0.98.16-1.el5_8


How reproducible:


Steps to Reproduce:
[root@qe-blade-04 ~]# rhn-migrate-classic-to-rhsm
RHN Username: qa
Password: 
Traceback (most recent call last):
  File "/usr/sbin/rhn-migrate-classic-to-rhsm", line 421, in ?
    main()
  File "/usr/sbin/rhn-migrate-classic-to-rhsm", line 393, in main
    checkOkToProceed(username, password)
  File "/usr/sbin/rhn-migrate-classic-to-rhsm", line 131, in checkOkToProceed
    cp.getOwnerList(username)
  File "/usr/lib/python2.4/site-packages/rhsm/connection.py", line 516, in getOwnerList
    return self.conn.request_get(method)
  File "/usr/lib/python2.4/site-packages/rhsm/connection.py", line 267, in request_get
    return self._request("GET", method)
  File "/usr/lib/python2.4/site-packages/rhsm/connection.py", line 234, in _request
    self.validateResponse(result)
  File "/usr/lib/python2.4/site-packages/rhsm/connection.py", line 249, in validateResponse
    raise RemoteServerException(response['status'])




[root@qe-blade-04 ~]# tail -f /var/log/rhsm/rhsm.log 
2012-02-15 14:17:30,272 [INFO]  @connection.py:354 - Using basic authentication as: qa
2012-02-15 14:17:30,272 [INFO]  @connection.py:375 - Connection Built: host: subscription.rhn.stage.redhat.com, port: 443, handler: /subscription
2012-02-15 14:17:30,273 [DEBUG]  @connection.py:200 - Loading CA PEM certificates from: /etc/rhsm/ca/
2012-02-15 14:17:30,273 [DEBUG]  @connection.py:183 - Loading CA certificate: '/etc/rhsm/ca/candlepin-stage.pem'
2012-02-15 14:17:30,274 [DEBUG]  @connection.py:183 - Loading CA certificate: '/etc/rhsm/ca/redhat-uep.pem'
2012-02-15 14:17:30,274 [DEBUG]  @connection.py:221 - Making request: GET /subscription/users/qa%40redhat.com/owners
2012-02-15 14:17:30,810 [DEBUG]  @connection.py:233 - Response status: 500
2012-02-15 14:17:30,811 [ERROR]  @connection.py:245 - No JSON object could be decoded
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/rhsm/connection.py", line 243, in validateResponse
    parsed = json.loads(response['content'])
  File "/usr/lib/python2.4/site-packages/simplejson/__init__.py", line 307, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.4/site-packages/simplejson/decoder.py", line 335, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.4/site-packages/simplejson/decoder.py", line 353, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
2012-02-15 14:17:30,812 [ERROR]  @connection.py:246 - Response: {'content': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"\n       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n\n<head>\n  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />\n  <title>We\'re sorry, but something went wrong (500)</title>\n\t<style type="text/css">\n\t\tbody { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }\n\t\tdiv.dialog {\n\t\t\twidth: 25em;\n\t\t\tpadding: 0 4em;\n\t\t\tmargin: 4em auto 0 auto;\n\t\t\tborder: 1px solid #ccc;\n\t\t\tborder-right-color: #999;\n\t\t\tborder-bottom-color: #999;\n\t\t}\n\t\th1 { font-size: 100%; color: #f00; line-height: 1.5em; }\n\t</style>\n</head>\n\n<body>\n  <!-- This file lives in public/500.html -->\n  <div class="dialog">\n    <h1>We\'re sorry, but something went wrong.</h1>\n    <p>We\'ve been notified about this issue and we\'ll take a look at it shortly.</p>\n  </div>\n</body>\n</html>\n', 'status': 500}
2012-02-15 14:17:30,812 [ERROR]  @connection.py:248 - remote server status code: 500

Comment 1 Alex Wood 2012-03-16 20:25:40 UTC
I believe this bug is fixed by 7d7208d88c1858104233c1c1a3b262f33916711e in subscription-manager-0.99.11+

Comment 2 RHEL Program Management 2012-04-02 10:19:36 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 5 Sharath Dwaral 2012-07-03 20:13:10 UTC
As stated in comment 0, reproduction of exactly the same bug is not fesiable since I cannot force a 500 server error. Instead I can demonstrate this error with the offending package installed.

# rpm -q subscription-manager
subscription-manager-0.98.16-1.el5_8

# rhn-migrate-classic-to-rhsm
RHN Username: blah.blah
Password: 
Unable to connect to certificate server.  See /var/log/rhsm/rhsm.log for more details.

The log file reads as below:

2012-07-03 14:00:11,480 [INFO]  @repolib.py:107 - repos updated: 0
2012-07-03 14:11:39,058 [INFO]  @connection.py:354 - Using basic authentication as: blah.blah
2012-07-03 14:11:39,058 [INFO]  @connection.py:375 - Connection Built: host: subscription.rhn.redhat.com, port: 443, handler: /subscription
2012-07-03 14:11:39,059 [DEBUG]  @connection.py:200 - Loading CA PEM certificates from: /etc/rhsm/ca/
2012-07-03 14:11:39,059 [DEBUG]  @connection.py:183 - Loading CA certificate: '/etc/rhsm/ca/candlepin-stage.pem'
2012-07-03 14:11:39,060 [DEBUG]  @connection.py:183 - Loading CA certificate: '/etc/rhsm/ca/candlepin-local.pem'
2012-07-03 14:11:39,061 [DEBUG]  @connection.py:183 - Loading CA certificate: '/etc/rhsm/ca/fsharath-candlepin.pem'
2012-07-03 14:11:39,061 [DEBUG]  @connection.py:183 - Loading CA certificate: '/etc/rhsm/ca/redhat-uep.pem'
2012-07-03 14:11:39,062 [DEBUG]  @connection.py:221 - Making request: GET /subscription/users/blah.blah/owners
2012-07-03 14:11:39,598 [DEBUG]  @connection.py:233 - Response status: 401

Running the same test with latest subscription-manager

# rpm - qa | egrep "subscription-manager|python-rhsm"
subscription-manager-debuginfo-1.0.6-1.el5
subscription-manager-firstboot-1.0.6-1.el5
subscription-manager-migration-data-1.11.2.2-1.git.0.2eea155.el5
subscription-manager-1.0.6-1.el5
subscription-manager-gui-1.0.6-1.el5
subscription-manager-migration-1.0.6-1.el5
python-rhsm-1.0.3-1.el5


# rhn-migrate-classic-to-rhsm
RHN Username: blah
Password: 
Unable to connect to certificate server: Invalid username or password. To create a login, please visit https://www.redhat.com/wapps/ugc/register.html.  See /var/log/rhsm/rhsm.log for more details.

The log file reads as below:

RepoMDError: requested datatype productid not available
2012-07-03 15:13:47,302 [INFO]  @connection.py:475 - Using basic authentication as: blah
2012-07-03 15:13:47,302 [INFO]  @connection.py:496 - Connection Built: host: subscription.rhn.redhat.com, port: 443, handler: /subscription
2012-07-03 15:13:47,303 [DEBUG]  @connection.py:308 - Loading CA PEM certificates from: /etc/rhsm/ca/
2012-07-03 15:13:47,303 [DEBUG]  @connection.py:290 - Loading CA certificate: '/etc/rhsm/ca/candlepin-stage.pem'
2012-07-03 15:13:47,304 [DEBUG]  @connection.py:290 - Loading CA certificate: '/etc/rhsm/ca/candlepin-local.pem'
2012-07-03 15:13:47,305 [DEBUG]  @connection.py:290 - Loading CA certificate: '/etc/rhsm/ca/fsharath-candlepin.pem'
2012-07-03 15:13:47,305 [DEBUG]  @connection.py:290 - Loading CA certificate: '/etc/rhsm/ca/redhat-uep.pem'
2012-07-03 15:13:47,306 [DEBUG]  @connection.py:329 - Making request: GET /subscription/users/blah%40blah.com/owners
2012-07-03 15:13:47,820 [DEBUG]  @connection.py:342 - Response status: 401
2012-07-03 15:13:47,821 [ERROR]  @rhn-migrate-classic-to-rhsm:197 - Invalid username or password. To create a login, please visit https://www.redhat.com/wapps/ugc/register.html
2012-07-03 15:13:47,822 [ERROR]  @rhn-migrate-classic-to-rhsm:198 - Traceback (most recent call last):
  File "/usr/sbin/rhn-migrate-classic-to-rhsm", line 195, in checkOkToProceed
    cp.getOwnerList(username)
  File "/usr/lib/python2.4/site-packages/rhsm/connection.py", line 645, in getOwnerList
    return self.conn.request_get(method)
  File "/usr/lib/python2.4/site-packages/rhsm/connection.py", line 385, in request_get
    return self._request("GET", method)
  File "/usr/lib/python2.4/site-packages/rhsm/connection.py", line 347, in _request
    self.validateResponse(result)
  File "/usr/lib/python2.4/site-packages/rhsm/connection.py", line 372, in validateResponse
    raise RestlibException(response['status'], error_msg)
RestlibException: Invalid username or password. To create a login, please visit https://www.redhat.com/wapps/ugc/register.html


Moving to VERIFIED

Comment 7 Bryan Kearney 2012-12-10 21:42:41 UTC
Bug clean up, these are in the current release.