Bug 803756

Summary: subscription-manager service-level --list fails against older candlepin
Product: Red Hat Enterprise Linux 6 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Michael Stead <mstead>
Status: CLOSED ERRATA QA Contact: Entitlement Bugs <entitlement-bugs>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.3CC: mstead, skallesh, spandey, syeghiay
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: subscription-manager-0.99.12-1.git.6.ab35e6c.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 13:07:13 UTC Type: ---
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, 803762    

Description John Sefler 2012-03-15 15:22:33 UTC
Description of problem:
Based on sprint 40 planning, newer client functionality should fail gracefully against older candlepin servers


Version-Release number of selected component (if applicable):
[root@hp-xw9300-01 ~]# rpm -q subscription-manager
subscription-manager-0.99.9-1.el6.x86_64


How reproducible:


Steps to Reproduce:
deploy an older candlepin server (than 0.5.5 ish?)
configure client to use the older candlepin and register etc...

[root@hp-xw9300-01 ~]# subscription-manager service-level --list
Remote server error. Please check the connection details, or see /var/log/rhsm/rhsm.log for more information.

^^^ Expected that to fail more gracefully with a message stating something to the effect this service-level query functionality is not supported by the older candlepin server to which you are registered.




[root@hp-xw9300-01 ~]# tail -f /var/log/rhsm/rhsm.log

2012-03-15 11:10:31,642 [INFO]  @connection.py:389 - Using certificate authentication: key = /etc/pki/consumer/key.pem, cert = /etc/pki/consumer/cert.pem, ca = /etc/rhsm/ca/, insecure = False
2012-03-15 11:10:31,642 [INFO]  @connection.py:400 - Connection Built: host: subscription.rhn.stage.redhat.com, port: 443, handler: /subscription
2012-03-15 11:10:31,645 [INFO]  @connection.py:389 - Using certificate authentication: key = /etc/pki/consumer/key.pem, cert = /etc/pki/consumer/cert.pem, ca = /etc/rhsm/ca/, insecure = False
2012-03-15 11:10:31,645 [INFO]  @connection.py:400 - Connection Built: host: subscription.rhn.stage.redhat.com, port: 443, handler: /subscription
2012-03-15 11:10:31,648 [DEBUG]  @connection.py:217 - Loading CA PEM certificates from: /etc/rhsm/ca/
2012-03-15 11:10:31,649 [DEBUG]  @connection.py:200 - Loading CA certificate: '/etc/rhsm/ca/redhat-uep.pem'
2012-03-15 11:10:31,650 [DEBUG]  @connection.py:200 - Loading CA certificate: '/etc/rhsm/ca/candlepin-stage.pem'
2012-03-15 11:10:31,650 [DEBUG]  @connection.py:238 - Making request: GET /subscription/consumers/fd350157-136c-4ce7-83a0-768808f11ed4/owner
2012-03-15 11:10:32,558 [DEBUG]  @connection.py:252 - Response status: 200
2012-03-15 11:10:32,560 [DEBUG]  @connection.py:217 - Loading CA PEM certificates from: /etc/rhsm/ca/
2012-03-15 11:10:32,560 [DEBUG]  @connection.py:200 - Loading CA certificate: '/etc/rhsm/ca/redhat-uep.pem'
2012-03-15 11:10:32,561 [DEBUG]  @connection.py:200 - Loading CA certificate: '/etc/rhsm/ca/candlepin-stage.pem'
2012-03-15 11:10:32,562 [DEBUG]  @connection.py:238 - Making request: GET /subscription/owners/711497/servicelevels
2012-03-15 11:10:33,145 [DEBUG]  @connection.py:252 - Response status: 404
2012-03-15 11:10:33,146 [ERROR]  @connection.py:264 - No JSON object could be decoded
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 262, in validateResponse
    parsed = json.loads(response['content'])
  File "/usr/lib64/python2.6/site-packages/simplejson/__init__.py", line 307, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python2.6/site-packages/simplejson/decoder.py", line 335, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python2.6/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-03-15 11:10:33,147 [ERROR]  @connection.py:265 - Response: {'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?1322764663" media="screen" rel="stylesheet" type="text/css" />\n  <link href="/clonepin/stylesheets/errorpage.css?1322764663" 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, 'candlepin_version': None}
2012-03-15 11:10:33,148 [ERROR]  @connection.py:267 - remote server status code: 404
2012-03-15 11:10:33,148 [ERROR]  @managercli.py:94 - Error: Unable to retrieve service levels.
2012-03-15 11:10:33,149 [ERROR]  @managercli.py:95 - 
Traceback (most recent call last):
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 594, in _do_command
    self.list_service_levels()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 616, in list_service_levels
    slas = self.cp.getServiceLevelList(org_key)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 677, in getServiceLevelList
    results = self.conn.request_get(method)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 291, in request_get
    return self._request("GET", method)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 253, in _request
    self.validateResponse(result)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 268, in validateResponse
    raise RemoteServerException(response['status'])
RemoteServerException


  
Actual results:


Expected results:


Additional info:

Comment 1 Michael Stead 2012-03-21 14:10:43 UTC
Fixed by 5e981d0b9639a89bbc00e8f1add247f3ff049aae in master branch.

Available in subscription-manager-0.99.11+

Comment 2 Michael Stead 2012-03-21 14:14:08 UTC
Commit mentioned above is a string change, the main fix was done in commit 05dedb4b94d19fc435b7505188977390badabaaa

Comment 5 Shwetha Kallesh 2012-03-26 12:03:43 UTC
Moving the bug back to new.

[root@skallesh ~]# rpm -qa | grep subscription-manager
subscription-manager-debuginfo-0.99.12-1.el6.x86_64
subscription-manager-gnome-0.99.12-1.el6.x86_64
subscription-manager-0.99.12-1.el6.x86_64
subscription-manager-migration-0.99.12-1.el6.x86_64
subscription-manager-firstboot-0.99.12-1.el6.x86_64
subscription-manager-migration-data-1.12.1.1-1.git.6.ea6813e.el6.noarch
[root@skallesh ~]# rpm -qa | grep python-rhsm
python-rhsm-0.99.7-1.el6.noarch


[root@skallesh ~]# subscription-manager service-level --list
Remote server error. Please check the connection details, or see /var/log/rhsm/rhsm.log for more information.

Comment 6 Michael Stead 2012-03-26 12:33:46 UTC
Which version of candlepin was this tested against? Also, could you please attach your rhsm.log file?

Comment 8 Michael Stead 2012-03-28 16:31:14 UTC
Fixed in master: 525a98819029ea141ecc756a199cbb377ec28872

Available in: subscription-manager-0.99.13-1+

Comment 9 John Sefler 2012-03-29 20:42:52 UTC
Verifying version...
[root@jsefler-r63-workstation ~]# rpm -q subscription-manager
subscription-manager-0.99.12-1.git.6.ab35e6c.el6.x86_64
candlepin-jboss-0.5.5.2-1.el6 (is deployed in stage env)

[root@jsefler-r63-workstation ~]# subscription-manager config --server.hostname subscription.rhn.stage.redhat.com --server.port 443 --server.prefix /subscription
[root@jsefler-r63-workstation ~]# subscription-manager register --username stage_test_27 --password redhat
The system has been registered with id: fa53ef50-2d61-40bc-985c-e7cd34ca8e86 
[root@jsefler-r63-workstation ~]# subscription-manager service-level --list
ERROR: The service-level command is not supported by the server.

^^^^^  VERIFIED

Comment 10 Shwetha Kallesh 2012-04-03 08:00:55 UTC
Moving to verified..

[root@skallesh ~]# rpm -qa | grep subscription-manager
subscription-manager-debuginfo-0.99.12-1.el6.x86_64
subscription-manager-firstboot-0.99.12-1.git.15.a46d527.el6.x86_64
subscription-manager-migration-data-1.12.1.2-1.git.0.9e244c8.el6.noarch
subscription-manager-gnome-0.99.12-1.git.15.a46d527.el6.x86_64
subscription-manager-0.99.12-1.git.15.a46d527.el6.x86_64
subscription-manager-migration-0.99.12-1.git.15.a46d527.el6.x86_64


[root@skallesh ~]# subscription-manager service-level --list
ERROR: The service-level command is not supported by the server.

Comment 12 errata-xmlrpc 2012-06-20 13:07:13 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-0804.html