Bug 1383927 - Fail to register a system using an Activation Key via command line
Summary: Fail to register a system using an Activation Key via command line
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: subscription-manager
Version: 7.3
Hardware: Unspecified
OS: Unspecified
urgent
high
Target Milestone: rc
: ---
Assignee: candlepin-bugs
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks: 1387718
TreeView+ depends on / blocked
 
Reported: 2016-10-12 07:48 UTC by Wei Liu
Modified: 2016-10-21 16:09 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1387718 (view as bug list)
Environment:
Last Closed: 2016-10-20 14:41:16 UTC
Target Upstream Version:


Attachments (Terms of Use)
The rhsm.log (2.86 KB, text/plain)
2016-10-12 07:49 UTC, Wei Liu
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1380668 1 None None None 2021-01-20 06:05:38 UTC

Internal Links: 1380668

Description Wei Liu 2016-10-12 07:48:07 UTC
Description of problem:
Fail to register with valid Org Id and Activation Key via command line,remind that"No activation key was applied successfully."

Version-Release number of selected component (if applicable):
python-rhsm-1.17.9-1.el7.x86_64
python-rhsm-certificates-1.17.9-1.el7.x86_64
subscription-manager-1.17.15-1.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1.Install redhat-virtualization-host-4.0-20161007.0.x86_64
2.Try to register with valid Org Id and Activation Key
#subscription-manager register --org=7967630 --activationkey=liuwei


Actual results:
Fail to register and remind that"No activation key was applied successfully."

Expected results:
Register correctly

Additional info:

Comment 1 Wei Liu 2016-10-12 07:49:01 UTC
Created attachment 1209499 [details]
The rhsm.log

Comment 4 Chris Snyder 2016-10-17 14:36:12 UTC
Can we see the contents of /etc/rhsm/facts/custom.facts? We suspect the failure to apply the activation key stems from it's contents.

Comment 6 Wei Liu 2016-10-18 08:39:28 UTC
The content of custom.facts is: 
{"cpu.cpu_socket(s)":"4"}

[root@hp-z220-15 facts]# subscription-manager unregister
System has been unregistered.
[root@hp-z220-15 facts]# subscription-manager register --org=7967630 --activationkey=liuwei
No activation key was applied successfully.
[root@hp-z220-15 facts]# cat custom.facts 
{"cpu.cpu_socket(s)":"4"}
[root@hp-z220-15 facts]#

Comment 7 Chris Snyder 2016-10-20 14:41:16 UTC
This is working as designed as the pool will work only for virtual guests.

Comment 8 John Sefler 2016-10-20 14:48:22 UTC
As shown below, I can reproduce the failure when attempting to use this activation key from a physical system...

[root@jsefler-rhel7 ~]# cat /etc/rhsm/facts/custom.facts 
{"cpu.cpu_socket(s)":"4","virt.is_guest":"false"}
[root@jsefler-rhel7 ~]# subscription-manager register --org=7967630 --activationkey=liuwei
No activation key was applied successfully.



And successfully register with this key from a virtual system...

[root@jsefler-rhel7 ~]# cat /etc/rhsm/facts/custom.facts 
{"cpu.cpu_socket(s)":"4","virt.is_guest":"true"}
[root@jsefler-rhel7 ~]# subscription-manager register --org=7967630 --activationkey=liuwei
The system has been registered with ID: 03b40b2f-908b-49e8-8834-58c47249a6b5 

Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed



Therefore the pool attached to the key is restricted to physical_only systems.

Comment 9 John Sefler 2016-10-21 15:24:02 UTC
(In reply to John Sefler from comment #8)
> Therefore the pool attached to the key is restricted to physical_only
> systems.

Oops, Typo above, should have said...
Therefore the pool attached to the key is restricted to virt_only systems

and you can see that in the pool attributes of comment 3

Comment 10 John Sefler 2016-10-21 16:00:10 UTC
The problem with this bug is that the user experience is poor.  The user is attempting to use an activation key, but because none of the pools in the key were applied successfully, no registration occurs.  Unfortunately the reason that no pool was applied successfully is hidden from the user.  It is buried in the candlepin logs that the user does not have access to.

This behavior was a conscious decision introduced in candlepin commit https://github.com/candlepin/candlepin/commit/bcb4b8fd8ee009e86fc9a1a20b25f19b3dbe6b2a

Part of the goal of that ^ commit was to make activation keys be more forgiving and succeed so long as at least one pool was attached and hide from the user all the pools that were not attached.  This was a request from Satellite who wanted to maintain fewer keys that contained more pools (one of which should apply).  So long as one pool was attached, then registration with the activation key was considered a success.

That is why this bug was CLOSED NOTABUG

Prior to this commit a stderr message was output to the user informing why each of the pools failed to attach.  In the case of the scenario in comment 0, the user would have seen in stderr  "Pool is restricted to virtual guests: '8a99f9815771b1a301577550acd808ad'."

In my opinion, I'd like to see this bug re-opened as an RFE that requests... If "No activation key was applied successfully", please revert back to some of the original behavior that listed out all the failure reasons why each pool in the keys was not attached?  The output might look like this...

[root@jsefler-rhel7 ~]# subscription-manager register --org=7967630 --activationkey=liuwei
No activation key was applied successfully.
Pool is restricted to virtual guests: '8a99f9815771b1a301577550acd808ad'.


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