This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
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 2268552 - [Improvement] Global Registration to check AK / CV / LE assignment
Summary: [Improvement] Global Registration to check AK / CV / LE assignment
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Registration
Version: 6.14.1
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Satellite QE Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-03-08 08:11 UTC by Pavel Moravec
Modified: 2024-06-06 17:25 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2024-06-06 17:25:35 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker   SAT-23862 0 None Migrated None 2024-06-06 17:25:33 UTC
Red Hat Knowledge Base (Solution) 7059235 0 None None None 2024-03-08 08:11:08 UTC

Description Pavel Moravec 2024-03-08 08:11:08 UTC
Description of problem:
Global registration can generate curl command with parameters of 1) an Activation Key for a CV/LE and 2) a dedicated LE, such that the CV/LE combination is invalid. Example: AK for Default CV and Library, LE = whatever non-Library. Then an attempt to register such host fails with quite cryptic error:

PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint index_cve_cp_id
DETAIL:  Key (cp_id)=(a5a0481ad60633eb239ec61f522ce4d2) already exists.

We have a KCS for it: https://access.redhat.com/solutions/7059235 but still it makes sense to have a check to prevent those misconfigs, directly in WebUI wizard and in hammer / API response.


Version-Release number of selected component (if applicable):
Sat 6.13+


How reproducible:
100%


Steps to Reproduce:
1. Create AK for Default CV and Library
2. Have another LE, say DEV
3. In WebUI, prepare a curl command for Global Registration for the AK and DEV
4. alternative hammer commands for 1.-3.:

activation-key create --organization-id 1 --name AK_default --lifecycle-environment Library  --content-view "Default Organization View"

lifecycle-environment create --organization-id 1 --name DEV --prior Library

host-registration generate-command --organization-id 1 --activation-key ak_default --lifecycle-environment DEV

5. Use the curl command to register a Host


Actual results:
3. and 4. prepares a curl command like:

curl -sS  'https://satellite.fqdn/register?activation_keys=ak_default&lifecycle_environment_id=2&organization_id=1'

for invalid combination of CV and LE

5. fails with:
PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint index_cve_cp_id
DETAIL:  Key (cp_id)=(a5a0481ad60633eb239ec61f522ce4d2) already exists.


Expected results:
3. and 4. fails with a warning that given combination of CV and LE does not exist.


Additional info:
The above is the most minimalistic reproducer (hence exactly that seen at a customer). A fix should cover scenarios where having multiple AKs against mutliple CV/LEs, but neither CV is promoted to the selected LE.

Comment 1 Shweta Singh 2024-03-19 13:08:50 UTC
Global Registration doesn't take "--lifecycle-environment" option in the command. It only uses activation key and LCE in which activation key created. Not sure if the reproducing steps are complete.

Comment 2 Pavel Moravec 2024-03-19 14:42:01 UTC
(In reply to Shweta Singh from comment #1)
> Global Registration doesn't take "--lifecycle-environment" option in the
> command. It only uses activation key and LCE in which activation key
> created. Not sure if the reproducing steps are complete.

hammer> host-registration generate-command --organization-id 1 --activation-key ak_default --lifecycle-environment DEV
curl -sS  'https://pmoravec-sat614.gsslab.brq2.redhat.com/register?activation_keys=ak_default&lifecycle_environment_id=2&organization_id=1' -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0LCJpYXQiOjE3MTA4NTkyNTEsImp0aSI6IjJlZWJkMzcwMWNiNjY5YTk3ZGFlN2M4MTdjMzU0N2E4Mjg1YTNhOTdhMWQ3Nzg3N2U3YTQ4ZDBjMjFjZDc2ZWMiLCJleHAiOjE3MTA4NzM2NTEsInNjb3BlIjoicmVnaXN0cmF0aW9uI2dsb2JhbCByZWdpc3RyYXRpb24jaG9zdCJ9.s5CGJUjNTKKeT-OUh2027U2LBjIn4m9oVmRx7UMO87s' | bash
hammer> 


The reproducer steps do contain also this hammer command and all of them do work on my Sat6.14 .

Comment 3 Leos Stejskal 2024-03-26 12:17:45 UTC
Hi, the Lifecycle Environment has been removed from the registration form,
for more details see the commit: https://github.com/Katello/katello/commit/337b5d6163d324ad601a4165e90dae7de4779392

Comment 4 Eric Helms 2024-06-06 17:25:35 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "SAT-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.


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