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 1701541

Summary: Registration fails when duplicate activation key names given to --activationkey option
Product: Red Hat Satellite Reporter: momran
Component: Hosts - ContentAssignee: Jonathon Turel <jturel>
Status: CLOSED ERRATA QA Contact: Stephen Wadeley <swadeley>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.5.0CC: jturel, redakkan, wpoteat
Target Milestone: 6.10.0Keywords: FutureFeature, Reopened
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-16 14:08:28 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:14:40 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 Chris Williams 2020-11-11 21:47:52 UTC
Red Hat Enterprise Linux 7 shipped it's final minor release on September 29th, 2020. 7.9 was the last minor releases scheduled for RHEL 7.
From intial triage it does not appear the remaining Bugzillas meet the inclusion criteria for Maintenance Phase 2 and will now be closed. 

From the RHEL life cycle page:
https://access.redhat.com/support/policy/updates/errata#Maintenance_Support_2_Phase
"During Maintenance Support 2 Phase for Red Hat Enterprise Linux version 7,Red Hat defined Critical and Important impact Security Advisories (RHSAs) and selected (at Red Hat discretion) Urgent Priority Bug Fix Advisories (RHBAs) may be released as they become available."

If this BZ was closed in error and meets the above criteria please re-open it flag for 7.9.z, provide suitable business and technical justifications, and follow the process for Accelerated Fixes:
https://source.redhat.com/groups/public/pnt-cxno/pnt_customer_experience_and_operations_wiki/support_delivery_accelerated_fix_release_handbook  

Feature Requests can re-opened and moved to RHEL 8 if the desired functionality is not already present in the product. 

Please reach out to the applicable Product Experience Engineer[0] if you have any questions or concerns.  

[0] https://bugzilla.redhat.com/page.cgi?id=agile_component_mapping.html&product=Red+Hat+Enterprise+Linux+7

Comment 4 Jonathon Turel 2020-12-11 16:19:50 UTC
Created redmine issue https://projects.theforeman.org/issues/31498 from this bug

Comment 5 Bryan Kearney 2020-12-12 00:02:28 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/31498 has been resolved.

Comment 7 Brad Buckingham 2021-01-07 17:08:54 UTC
*** Bug 1701543 has been marked as a duplicate of this bug. ***

Comment 11 errata-xmlrpc 2021-11-16 14:08:28 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 (Moderate: Satellite 6.10 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:4702