Bug 717415 - subscription-manager register with --consumerid is failing
Summary: subscription-manager register with --consumerid is failing
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager
Version: 6.2
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: rc
: ---
Assignee: Bryan Kearney
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks: rhsm-rhel62
TreeView+ depends on / blocked
 
Reported: 2011-06-28 19:20 UTC by John Sefler
Modified: 2011-12-06 17:15 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-12-06 17:15:39 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1695 0 normal SHIPPED_LIVE subscription-manager bug fix and enhancement update 2011-12-06 01:23:29 UTC

Description John Sefler 2011-06-28 19:20:40 UTC
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 23:17:06 UTC
fixed in b72becbcc00d3bd38db50ba7063f6252c576e584

Comment 4 John Sefler 2011-06-30 18:46:48 UTC
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 20:08:27 UTC
Fixed in master at e6eb14df290653e878d13089d65b63c7271b9a45

Comment 6 spandey 2011-07-11 10:58:51 UTC
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 17:15:39 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-2011-1695.html


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