Bug 717415 - subscription-manager register with --consumerid is failing
subscription-manager register with --consumerid is failing
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager (Show other bugs)
6.2
Unspecified Unspecified
unspecified Severity high
: rc
: ---
Assigned To: Bryan Kearney
John Sefler
:
Depends On:
Blocks: rhsm-rhel62
  Show dependency treegraph
 
Reported: 2011-06-28 15:20 EDT by John Sefler
Modified: 2011-12-06 12:15 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-12-06 12:15:39 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description John Sefler 2011-06-28 15:20:40 EDT
Description of problem:
local variable 'admin_cp' referenced before assignment is being thrown when calling subscription-manager register with --consumerid

Version-Release number of selected component (if applicable):
[root@jsefler-onprem-62server ~]# rpm -q subscription-manager
subscription-manager-0.96.2-1.git.6.a062826.el6.x86_64


How reproducible:


Steps to Reproduce:
[root@jsefler-onprem-62server ~]# subscription-manager register --username=testuser1 --password=password --owner=admin
The system has been registered with id: f314d5b7-8b53-441e-b5aa-50309dd3de7d 
[root@jsefler-onprem-62server ~]# subscription-manager clean
All local data removed
[root@jsefler-onprem-62server ~]# subscription-manager register --username=testuser1 --password=password --consumerid=f314d5b7-8b53-441e-b5aa-50309dd3de7d
local variable 'admin_cp' referenced before assignment

 
Actual results:
local variable 'admin_cp' referenced before assignment

Expected results:
The system has been registered with id: f314d5b7-8b53-441e-b5aa-50309dd3de7d

Additional info:
[root@jsefler-onprem-62server ~]# tail -f /var/log/rhsm/rhsm.log
2011-06-28 15:13:49,302 [INFO]  @connection.py:320 - Using certificate authentication: key = /etc/pki/consumer/key.pem, cert = /etc/pki/consumer/cert.pem, ca = /etc/rhsm/ca/, insecure = False
2011-06-28 15:13:49,302 [INFO]  @connection.py:330 - Connection Established: host: jsefler-onprem-62candlepin.usersys.redhat.com, port: 8443, handler: /candlepin
2011-06-28 15:13:49,395 [ERROR]  @managercli.py:50 - Error during registration: local variable 'admin_cp' referenced before assignment
2011-06-28 15:13:49,395 [ERROR]  @managercli.py:51 - local variable 'admin_cp' referenced before assignment
Traceback (most recent call last):
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 462, in _do_command
    consumer = admin_cp.getConsumer(self.options.consumerid,
UnboundLocalError: local variable 'admin_cp' referenced before assignment
Comment 2 Bryan Kearney 2011-06-29 19:17:06 EDT
fixed in b72becbcc00d3bd38db50ba7063f6252c576e584
Comment 4 John Sefler 2011-06-30 14:46:48 EDT
The error seems to have shifted when trying to register with --consumerid...

[root@jsefler-onprem-62server ~]# subscription-manager register --username=testuser1 --password=password --owner=admin
The system has been registered with id: 36164344-c66e-4609-a78b-3c65d5eb33ca 
[root@jsefler-onprem-62server ~]# subscription-manager clean
All local data removed

[root@jsefler-onprem-62server ~]# subscription-manager register --username=testuser1 --password=password --consumerid=36164344-c66e-4609-a78b-3c65d5eb33ca
Insufficient permissions

^^^ I EXPECTED THIS TO SUCCEED

[root@jsefler-onprem-62server ~]# subscription-manager register --username=testuser1 --password=password --consumerid=36164344-c66e-4609-a78b-3c65d5eb33ca --owner=admin
Insufficient permissions


^^^ SPECIFYING OWNER (WHICH I DON"T THINK IS NECESSARY) DOESN'T WORK EITHER


[root@jsefler-onprem-62server ~]# tail -20 /var/log/rhsm/rhsm.log
2011-06-30 14:35:57,684 [INFO]  @connection.py:168 - work in insecure mode ?:False
2011-06-30 14:35:57,684 [INFO]  @connection.py:172 - loading ca pem certificates from: /etc/rhsm/ca/
2011-06-30 14:35:57,685 [INFO]  @connection.py:156 - loading ca certificate '/etc/rhsm/ca/fakamai-cp1.pem'
2011-06-30 14:35:57,685 [INFO]  @connection.py:156 - loading ca certificate '/etc/rhsm/ca/jsefler-onprem-62candlepin.pem'
2011-06-30 14:35:57,686 [INFO]  @connection.py:156 - loading ca certificate '/etc/rhsm/ca/redhat-uep.pem'
2011-06-30 14:35:57,687 [INFO]  @connection.py:156 - loading ca certificate '/etc/rhsm/ca/candlepin-stage.pem'
2011-06-30 14:35:57,805 [INFO]  @connection.py:199 - status code: 403
2011-06-30 14:35:57,806 [ERROR]  @managercli.py:492 - Insufficient permissions
Traceback (most recent call last):
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 468, in _do_command
    self.username, self.password)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 402, in getConsumer
    return self.conn.request_get(method)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 222, in request_get
    return self._request("GET", method)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 200, in _request
    self.validateResponse(result)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 219, in validateResponse
    parsed['displayMessage'])
RestlibException: Insufficient permissions
[root@jsefler-onprem-62server ~]# 



[root@jsefler-onprem-62server ~]# rpm -q subscription-manager
subscription-manager-0.96.2-1.git.13.b72becb.el6.x86_64
Comment 5 Bryan Kearney 2011-06-30 16:08:27 EDT
Fixed in master at e6eb14df290653e878d13089d65b63c7271b9a45
Comment 6 spandey 2011-07-11 06:58:51 EDT
verified using following rpm 

[root@sachbeta ~]# rpm -qa | grep subscription-manager
subscription-manager-gnome-0.96.3-1.git.0.723b652.el6.x86_64
subscription-manager-firstboot-0.96.3-1.git.0.723b652.el6.x86_64
subscription-manager-0.96.3-1.git.0.723b652.el6.x86_64
[root@sachbeta ~]# 



[root@sachbeta ~]# subscription-manager register --u admin --password admin --org admin --consumerid c1b70672-aae1-42ce-a3a5-1722a6d52629
The system has been registered with id: c1b70672-aae1-42ce-a3a5-1722a6d52629 
[root@sachbeta ~]# subscription-manager register --u admin --password admin --org admin --consumerid 43378a0b-1d2c-4a11-8d2b-5d2ce8db023a --force
The system with UUID c1b70672-aae1-42ce-a3a5-1722a6d52629 has been unregistered
The system has been registered with id: 43378a0b-1d2c-4a11-8d2b-5d2ce8db023a 


[root@sachbeta ~]# subscription-manager register --u testuser1 --password password --org admin --consumerid 98eb3084-e03c-4c17-a874-921099b23178 --force
The system has been registered with id: 98eb3084-e03c-4c17-a874-921099b23178 
[root@sachbeta ~]# subscription-manager register --u testuser1 --password password --org admin --consumerid 514caaf8-2a10-4903-829c-fc6bcf613363 --force
The system has been registered with id: 514caaf8-2a10-4903-829c-fc6bcf613363 


Working Fine Changing defect status from modified to verified
Comment 7 errata-xmlrpc 2011-12-06 12:15:39 EST
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-2011-1695.html

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