Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 804076

Summary: subscription-manager repos --list fails against older candlepin
Product: Red Hat Enterprise Linux 6 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Adrian Likins <alikins>
Status: CLOSED ERRATA QA Contact: Entitlement Bugs <entitlement-bugs>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.3CC: alikins, skallesh, spandey
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: 2012-06-20 13:07:37 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    

Description John Sefler 2012-03-16 13:45:51 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.10-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 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@ibm-ls22-04 ~]# grep hostname /etc/rhsm/rhsm.conf 
# Server hostname:
hostname=subscription.rhn.stage.redhat.com
proxy_hostname=
[root@ibm-ls22-04 ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.3 Beta (Santiago)
[root@ibm-ls22-04 ~]# subscription-manager register --username stage_test_12 --autosubscribe
Password: 
The system has been registered with id: 6c49dcfd-e4cd-458b-8466-e77ee968cacb 
Installed Product Current Status:
Product Name:         	Red Hat Enterprise Linux Server
Status:               	Subscribed               

[root@ibm-ls22-04 ~]# subscription-manager repos --list
'NoneType' object has no attribute 'getRelease'
[root@ibm-ls22-04 ~]# 

^^^ Expected to see the entitled repos listed with the default $releasever
Something similar to this....
RepoName: Red Hat Enterprise Linux 6 Server (RPMs)
RepoId: rhel-6-server-rpms
RepoUrl: https://cdn.redhat.com/content/dist/rhel/server/6/$releasever/$basearch/os
Enabled: 1 




[root@ibm-ls22-04 ~]# tail -f /var/log/rhsm/rhsm.log
2012-03-16 09:41:47,656 [ERROR]  @managercli.py:96 - exception caught in subscription-manager
2012-03-16 09:41:47,656 [ERROR]  @managercli.py:97 - 'NoneType' object has no attribute 'getRelease'
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 1727, in main
    return cmd.main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 267, in main
    return_code = self._do_command()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 1360, in _do_command
    repos = rl.get_repos()
  File "/usr/share/rhsm/subscription_manager/repolib.py", line 45, in get_repos
    action = UpdateAction(uep=self.uep)
  File "/usr/share/rhsm/subscription_manager/repolib.py", line 96, in __init__
    self.release = self.uep.getRelease(self.consumer_uuid)
AttributeError: 'NoneType' object has no attribute 'getRelease'

Comment 2 Adrian Likins 2012-03-19 19:11:47 UTC
commit 6dceb13072f8fe6c48b7bd38dd04c289c3ba6661
Author: Adrian Likins <alikins>
Date:   Mon Mar 19 10:44:48 2012 -0400

    804227: Fix issues with repos --list
    
    We weren't setting up a uep connection because this
    module was setup to not need a network connection,
    which it needs now.


(Yeah, that's got the wrong bug id). This fixes the repos --list
error.

Comment 4 John Sefler 2012-03-19 20:00:19 UTC
(In reply to comment #0)
> [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.

Ooops.  This comment was accidentally pasted into this bug.  It belongs in bug 803756.

Comment 5 John Sefler 2012-03-19 20:12:27 UTC
[root@jsefler-r63-server ~]# rpm -q subscription-manager
subscription-manager-0.99.10-1.git.80.a5fa07f.el6.x86_64

[root@jsefler-r63-server ~]# subscription-manager register --username stage_test_12 --autosubscribe
Password: 
The system has been registered with id: 06b441a6-0b07-4929-84ff-bd5ac33e0efb 
Installed Product Current Status:
Product Name:         	Red Hat Enterprise Linux Server
Status:               	Subscribed               

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

^^^^^^^^^^^^^^^^^^^
Still encountering tracebacks in rhsm.log against the hosted candlepin currently deployed in stage environment.




[root@jsefler-r63-server tmp]# tail -f /var/log/rhsm/rhsm.log
2012-03-19 16:05:03,094 [INFO]  @connection.py:488 - Using certificate authentication: key = /etc/pki/consumer/key.pem, cert = /etc/pki/consumer/cert.pem, ca = /etc/rhsm/ca/, insecure = False
2012-03-19 16:05:03,095 [INFO]  @connection.py:499 - Connection Built: host: subscription.rhn.stage.redhat.com, port: 443, handler: /subscription
2012-03-19 16:05:03,097 [DEBUG]  @connection.py:308 - Loading CA PEM certificates from: /etc/rhsm/ca/
2012-03-19 16:05:03,097 [DEBUG]  @connection.py:290 - Loading CA certificate: '/etc/rhsm/ca/jsefler-f14-candlepin.pem'
2012-03-19 16:05:03,098 [DEBUG]  @connection.py:290 - Loading CA certificate: '/etc/rhsm/ca/redhat-uep.pem'
2012-03-19 16:05:03,099 [DEBUG]  @connection.py:290 - Loading CA certificate: '/etc/rhsm/ca/candlepin-stage.pem'
2012-03-19 16:05:03,099 [DEBUG]  @connection.py:329 - Making request: GET /subscription/consumers/06b441a6-0b07-4929-84ff-bd5ac33e0efb/release
2012-03-19 16:05:03,519 [DEBUG]  @connection.py:343 - Response status: 404
2012-03-19 16:05:03,523 [ERROR]  @connection.py:360 - No JSON object could be decoded
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 358, 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-19 16:05:03,528 [ERROR]  @connection.py:361 - 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-19 16:05:03,529 [ERROR]  @connection.py:363 - remote server status code: 404
2012-03-19 16:05:03,530 [ERROR]  @managercli.py:100 - exception caught in subscription-manager
2012-03-19 16:05:03,531 [ERROR]  @managercli.py:101 - 
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 1787, in main
    return cmd.main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 271, in main
    return_code = self._do_command()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 1377, in _do_command
    repos = rl.get_repos()
  File "/usr/share/rhsm/subscription_manager/repolib.py", line 45, in get_repos
    action = UpdateAction(uep=self.uep)
  File "/usr/share/rhsm/subscription_manager/repolib.py", line 96, in __init__
    self.release = self.uep.getRelease(self.consumer_uuid)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 770, in getRelease
    results = self.conn.request_get(method)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 387, in request_get
    return self._request("GET", method)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 348, in _request
    self.validateResponse(result)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 364, in validateResponse
    raise RemoteServerException(response['status'])
RemoteServerException

Comment 6 Adrian Likins 2012-03-21 16:55:49 UTC
commit 9d4307173b2fe17289066533d939ecdd2a1196d3
Author: Adrian Likins <alikins>
Date:   Tue Mar 20 16:38:00 2012 -0400

    804227,804076,804228: Handle 404's from old candlepin servers without /release
    
    The release/ystream support requires new candlepin api. If
    we get a 404 on that api, fail gracefully.

Comment 9 John Sefler 2012-03-29 19:22:25 UTC
Verifying Version....
[root@beast ~]# rpm -q subscription-manager
subscription-manager-0.99.12-1.el6.x86_64



[root@beast ~]# subscription-manager register --username stage_test_12 --autosubscribe
Password: 
The system has been registered with id: 51a32496-f3f5-4dfe-b59f-42dc64349f9e 
Installed Product Current Status:
Product Name:         	Red Hat Enterprise Linux Server
Status:               	Subscribed               

[root@beast ~]# subscription-manager repos --list
+----------------------------------------------------------+
    Entitled Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo Name:            	Red Hat CloudForms Tools for RHEL 6 (Source RPMs)
Repo Id:              	rhel-6-server-cf-tools-1-source-rpms
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/dist/rhel/server/6/$releasever/$basearch/cf-tools/1.0/source/SRPMS
Enabled:              	0                        

Repo Name:            	Red Hat Enterprise Linux 6 Server (RPMs)
Repo Id:              	rhel-6-server-rpms       
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/dist/rhel/server/6/$releasever/$basearch/os
Enabled:              	1                        

Repo Name:            	Red Hat CloudForms Tools for RHEL 6 Beta (RPMs)
Repo Id:              	rhel-6-server-cf-tools-1-beta-rpms
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/beta/rhel/server/6/$releasever/$basearch/cf-tools/1.0/os
Enabled:              	0                        

Repo Name:            	Red Hat Enterprise Linux 6 Server (Source RPMs)
Repo Id:              	rhel-6-server-source-rpms
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/dist/rhel/server/6/$releasever/$basearch/source/SRPMS
Enabled:              	0                        

Repo Name:            	Red Hat Enterprise Linux 6 Server Beta (Source RPMs)
Repo Id:              	rhel-6-server-beta-source-rpms
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/beta/rhel/server/6/$releasever/$basearch/source/SRPMS
Enabled:              	0                        

Repo Name:            	Red Hat Enterprise Linux 6 Server - Supplementary (RPMs)
Repo Id:              	rhel-6-server-supplementary
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/dist/rhel/server/6/$releasever/$basearch/supplementary/os
Enabled:              	0                        

Repo Name:            	Red Hat Enterprise Linux 6 Server - Optional (Debug RPMs)
Repo Id:              	rhel-6-server-optional-debug-rpms
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/dist/rhel/server/6/$releasever/$basearch/optional/debug
Enabled:              	0                        

Repo Name:            	Red Hat Enterprise Linux 6 Server - Supplementary Beta (RPMs)
Repo Id:              	rhel-6-server-supplementary-beta
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/beta/rhel/server/6/$releasever/$basearch/supplementary/os
Enabled:              	0                        

Repo Name:            	Red Hat CloudForms Tools for RHEL 6 (Debug RPMs)
Repo Id:              	rhel-6-server-cf-tools-1-debug-rpms
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/dist/rhel/server/6/$releasever/$basearch/cf-tools/1.0/debug
Enabled:              	0                        

Repo Name:            	Red Hat Enterprise Linux 6 Server (Debug RPMs)
Repo Id:              	rhel-6-server-debug-rpms 
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/dist/rhel/server/6/$releasever/$basearch/debug
Enabled:              	0                        

Repo Name:            	Red Hat Enterprise Linux 6 Server - Optional Beta (Debug RPMs)
Repo Id:              	rhel-6-server-optional-beta-debug-rpms
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/beta/rhel/server/6/$releasever/$basearch/optional/debug
Enabled:              	0                        

Repo Name:            	Red Hat Enterprise Linux 6 Server - Supplementary (Debug RPMs)
Repo Id:              	rhel-6-server-supplementary-debuginfo
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/dist/rhel/server/6/$releasever/$basearch/supplementary/debug
Enabled:              	0                        

Repo Name:            	Red Hat CloudForms Tools for RHEL 6 Beta (Source RPMs)
Repo Id:              	rhel-6-server-cf-tools-1-beta-source-rpms
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/beta/rhel/server/6/$releasever/$basearch/cf-tools/1.0/source/SRPMS
Enabled:              	0                        

Repo Name:            	Red Hat Subscription Asset Manager (for RHEL 6 Server) Beta (Debug RPMs)
Repo Id:              	rhel-6-server-sam-beta-debug-rpms
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/beta/rhel/server/6/$releasever/$basearch/sam/debug
Enabled:              	0                        

Repo Name:            	Red Hat Enterprise Linux 6 Server - Optional Beta (Source RPMs)
Repo Id:              	rhel-6-server-optional-beta-source-rpms
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/beta/rhel/server/6/$releasever/$basearch/optional/source/SRPMS
Enabled:              	0                        

Repo Name:            	Red Hat Enterprise Linux 6 Server - Supplementary Beta (Debug RPMs)
Repo Id:              	rhel-6-server-supplementary-beta-debuginfo
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/beta/rhel/server/6/$releasever/$basearch/supplementary/debug
Enabled:              	0                        

Repo Name:            	Red Hat Enterprise Linux 6 Server - Supplementary Beta (Source RPMs)
Repo Id:              	rhel-6-server-supplementary-beta-src
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/beta/rhel/server/6/$releasever/$basearch/supplementary/source/SRPMS
Enabled:              	0                        

Repo Name:            	Red Hat Enterprise Linux 6 Server - Optional (Source RPMs)
Repo Id:              	rhel-6-server-optional-source-rpms
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/dist/rhel/server/6/$releasever/$basearch/optional/source/SRPMS
Enabled:              	0                        

Repo Name:            	Red Hat Enterprise Linux 6 Server - Optional Beta (RPMs)
Repo Id:              	rhel-6-server-optional-beta-rpms
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/beta/rhel/server/6/$releasever/$basearch/optional/os
Enabled:              	0                        

Repo Name:            	Red Hat Enterprise Linux 6 Server Beta (RPMs)
Repo Id:              	rhel-6-server-beta-rpms  
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/beta/rhel/server/6/$releasever/$basearch/os
Enabled:              	0                        

Repo Name:            	Red Hat Enterprise Linux 6 Server - Optional (RPMs)
Repo Id:              	rhel-6-server-optional-rpms
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/dist/rhel/server/6/$releasever/$basearch/optional/os
Enabled:              	0                        

Repo Name:            	Red Hat Enterprise Linux 6 Server Beta (Debug RPMs)
Repo Id:              	rhel-6-server-beta-debug-rpms
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/beta/rhel/server/6/$releasever/$basearch/debug
Enabled:              	0                        

Repo Name:            	Red Hat Subscription Asset Manager (for RHEL 6 Server) Beta (RPMs)
Repo Id:              	rhel-6-server-sam-beta-rpms
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/beta/rhel/server/6/$releasever/$basearch/sam/os
Enabled:              	0                        

Repo Name:            	Red Hat CloudForms Tools for RHEL 6 (RPMs)
Repo Id:              	rhel-6-server-cf-tools-1-rpms
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/dist/rhel/server/6/$releasever/$basearch/cf-tools/1.0/os
Enabled:              	1                        

Repo Name:            	Red Hat Subscription Asset Manager (for RHEL 6 Server) Beta (Source RPMs)
Repo Id:              	rhel-6-server-sam-beta-source-rpms
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/beta/rhel/server/6/$releasever/$basearch/sam/source/SRPMS
Enabled:              	0                        

Repo Name:            	Red Hat CloudForms Tools for RHEL 6 Beta (Debug RPMs)
Repo Id:              	rhel-6-server-cf-tools-1-beta-debug-rpms
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/beta/rhel/server/6/$releasever/$basearch/cf-tools/1.0/debug
Enabled:              	0                        

Repo Name:            	Red Hat Enterprise Linux 6 Server - Supplementary (Source RPMs)
Repo Id:              	rhel-6-server-supplementary-src
Repo Url:             	https://cdn.rcm-qa.redhat.com/content/dist/rhel/server/6/$releasever/$basearch/supplementary/source/SRPMS
Enabled:              	0                        

[root@beast ~]# subscription-manager release
ERROR: The 'release' command is not supported by the server.


^^^^ VERIFIED: While rhsm is configured to get entitlements from the older candlepin version currently deployed in the stage environment, it gracefully does not support the new release command, and repos --list works without substituting any value for $releasever.

Moving to VERIFIED

Comment 11 errata-xmlrpc 2012-06-20 13:07:37 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