Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite 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 "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. 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 "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-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 1701543

Summary: Enhance subscription-manager so that it can automatically supress duplicate activation keys specified by the --activationkey command-line option
Product: Red Hat Satellite Reporter: momran
Component: RegistrationAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED DUPLICATE QA Contact: Stephen Wadeley <swadeley>
Severity: low Docs Contact:
Priority: low    
Version: 6.5.0CC: dsinglet, redakkan
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-01-07 17:08:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description momran 2019-04-19 13:18:28 UTC
Description of problem:

As a result of many individual parts of automation and inheritance related to server provisioning, we might end up with duplicate activation-keys. 

This apperently results in an SQL-error on the server trying to register:

[root@hostname ~]# subscription-manager register --name="hostname.example.com" --org='Example' --activationkey='act-auto-attach-vdc,act-Verification-cv-soe-7Server,act-Verification-cv-soe-7Server'
HTTP error (500 - Internal Server Error): PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "katello_subscription_facet_activation_keys_sa_ak_id"
DETAIL:  Key (subscription_facet_id, activation_key_id)=(3530, 24) already exists.
: INSERT INTO "katello_subscription_facet_activation_keys" ("subscription_facet_id", "activation_key_id") VALUES ($1, $2) RETURNING "id"


In order to avoid encountering the error described above, the customer would like to have an enhanced version of subscription-manager, which is capable of identifying multiple activation key values specified using the --activationkey command-line option, and automatically supressing the duplicate values (if any).


The customer would test to confirm that the requirement is successfully implemented by executing a 'subscription-manager register' command that has duplicate activation key values specified using the --activationkey command-line option. For example:
~~~
[root@hostname ~]# subscription-manager register --name="hostname.example.com" --org='Example' --activationkey='act-auto-attach-vdc,act-Verification-cv-soe-7Server,act-Verification-cv-soe-7Server'
~~~


How reproducible:


Steps to Reproduce:
1. Perform a complete a basic kickstart-based installation using satellite
2. Try to register the newly installed host using subscription-manager with a valid activation-key mentioned 2 times (or more).


Actual results:

The following error message is received, and the host registration fails:
~~~
HTTP error (500 - Internal Server Error): PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "katello_subscription_facet_activation_keys_sa_ak_id"
DETAIL:  Key (subscription_facet_id, activation_key_id)=(3530, 24) already exists.
: INSERT INTO "katello_subscription_facet_activation_keys" ("subscription_facet_id", "activation_key_id") VALUES ($1, $2) RETURNING "id"
~~~


Expected results:

subscription-manager would be able to intelligently identify that there is a duplicate activation key specified, and suppress it, resulting in a successful system registration.

Comment 3 Rehana 2020-12-11 15:54:46 UTC
Hi , 

We have evaluated this request, and we believe more robust fix for this issue can be done in server side . Hence moving this bug to katello for consideration. 

Thanks,
Rehana

Comment 4 Brad Buckingham 2021-01-07 17:08:56 UTC

*** This bug has been marked as a duplicate of bug 1701541 ***