Hide Forgot
Description of problem: When running subscription-manager register with --activationkey and --consumerid specified the sysadmin is prompted to enter their username and password details. Upon entering username and password registration fails. Version-Release number of selected component (if applicable): subscription-manager-0.96.12-1.el6.x86_64 How reproducible: Every time Steps to Reproduce: 1. Pre-define a system in SAM. 2. Create a Activation Key, in SAM. 3. Run subscription-manager register --consumerid a30d659e-8b59-4b57-a4ff-acd280730738 --org ACME_Corporation --activationkey NibblerTestKey. Actual results: Sysadmin is prompted for username and password: Username: admin Password: Network error. Please check the connection details, or see /var/log/rhsm/rhsm.log for more information. <rhsm.log> 2011-10-27 14:21:00,676 [DEBUG] @connection.py:209 - Making request: GET /headpin/api/consumers/a30d659e-8b59-4b57-a4ff-acd280730738 2011-10-27 14:21:01,860 [DEBUG] @connection.py:218 - Response status: 401 2011-10-27 14:21:01,860 [ERROR] @connection.py:230 - No JSON object could be decoded Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 228, 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 2011-10-27 14:21:01,860 [ERROR] @connection.py:231 - Response: {'content': ' ', 'status': 401} 2011-10-27 14:21:01,861 [ERROR] @managercli.py:64 - Error during registration: 2011-10-27 14:21:01,861 [ERROR] @managercli.py:65 - Traceback (most recent call last): File "/usr/share/rhsm/subscription_manager/managercli.py", line 589, in _do_command self.username, self.password) File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 468, in getConsumer return self.conn.request_get(method) File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 252, in request_get return self._request("GET", method) File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 219, in _request self.validateResponse(result) File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 236, in validateResponse raise NetworkException(response['status']) NetworkException </rhsm.log> Expected results: User should not be prompted for username and password and registration should succeed. Customers may have the desire to pre-define systems and registration keys to deploy at a later time or in a automated fashion. Additional info:
since this is SAM/katello specific and given the timeframe, moving off to the next client release.
MODIFIED in 8903f69e6db0fd282e82ef150c6b2e93f55b77a4.
I'm not sure I agree with Eric's expected results above. Activation keys are designed to be a register/subscribe both in one transaction. As such, it is not necessary to predefine systems in one step and then go back later and apply an activation key to an already existing consumer. However if this two step process is really desired, then you could achieve the same result by registering with an existing consumerid and then subscribing to the known pool(s) that are in the activation key. This will achieve the same result and can also be automated. Having said that, attempts to register to an already created consumer AND passing an activation key are blocked as demonstrated below.... [root@jsefler-onprem-5server ~]# subscription-manager register --consumerid 55fe83f4-f6ac-4646-8c43-76923222960b --org admin --activationkey ActivationKey1323394918500WithMultiplePoolsForOrg_admin Error: Activation keys can not be used with previously registered ids. Version... [root@jsefler-onprem-5server ~]# rpm -q subscription-manager subscription-manager-0.98.7-1.git.0.b436f93.el5_7 One reason why is it appropriate to block a registration with an existing consumerid AND activationkey is that the consumer may already be consuming entitlements that the activationkey's pool would provide. Moreover, if the activationkey's pools are multi-entitlement pools matching what the consumer is already consuming, then you will over entitle the system and there would be no feedback stating the superfluous consumption. moving to VERIFIED
There is a use case for activation keys plus pre-defining a server, i.e. in some organizations the system may be defined in SAM (or Katello) prior to being registered - this would be done for planning or as some kind of internal workflow. With that said, I have tested a bit today and have found that I can not get activationkeys to behave in a predictable manner. Most recent Test: ** Server is _not_ pre-defined ** 1. Create activation key, assign a subscription. 2. On the consumer (system) register the machine: # subscription-manager register --org RedHat_QE --activationkey PinkyTestKey 3. Note the error: [/var/log/rhsm/rhsm.log] ... RestlibException: Pool with id 8a8b6605342356f20134248e9796000b could not be found ... [/var/log/rhsm/rhsm.log] However, SAM shows the system as subscribed and subscription-manager facts --list also shows the system as entitled. system.entitlements_valid: True subscription-manager-0.96.12-1.el6.x86_64 katello-headpin-all-0.1.112-2.el6.noarch
Attempting to complicate matters a little more, if I switch to a rhel62 version of subscription-manager, I get different results... [root@jsefler-stage-6server ~]# rpm -q subscription-manager subscription-manager-0.96.17-1.el6.x86_64 [root@jsefler-stage-6server ~]# rpm -q python-rhsm python-rhsm-0.96.15-1.el6.noarch Attempting to register with both an existing consumerid and a valid activationkey... [root@jsefler-stage-6server ~]# subscription-manager register --consumerid 3075809f-f8ff-40db-b5c0-a18fbe91b7f6 --org admin --activationkey ActivationKey1323653956155WithMultiplePoolsForOrg_admin Username: testuser1 Password: Insufficient permissions ^^ I suspect that this is the error that bkearney fixed in comment 2 and applied it to the RHEL5.8 subscription-manager stream. Note that on this rhel62 client, registration using a consumerid separately from an activation key work well for me... [root@jsefler-stage-6server ~]# subscription-manager register --org admin --activationkey ActivationKey1323653956155WithMultiplePoolsForOrg_admin The system has been registered with id: 4aea1c49-40c0-484c-ac00-6b0315104f23 [root@jsefler-stage-6server ~]# subscription-manager unsubscribe --all [root@jsefler-stage-6server ~]# subscription-manager clean All local data removed [root@jsefler-stage-6server ~]# subscription-manager register --consumerid 3075809f-f8ff-40db-b5c0-a18fbe91b7f6 Username: testuser1 Password: The system has been registered with id: 3075809f-f8ff-40db-b5c0-a18fbe91b7f6 Hence I suggest that this bug be cloned to rhel6.2.z for a cherry pick fix of the commit in comment 2
Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: No description necessary
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-0154.html