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 2223415

Summary: Force registering from a Capsule to the Satellite using global registration template fails with HTTP error code 422: Unprocessable Entity error
Product: Red Hat Satellite Reporter: Manu Sunil <msunil>
Component: RegistrationAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED MIGRATED QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.14.0CC: ahumbe, lstejska, nalfassi, rlavi
Target Milestone: UnspecifiedKeywords: MigratedToJIRA, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-06-06 16:24:46 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 Manu Sunil 2023-07-17 18:09:42 UTC
Description of problem:

- Force registering from a Capsule to the Satellite using global registration template fails with HTTP error code 422: Unprocessable Entity error.

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

- satellite-6.14.0-3.el8sat.noarch

How reproducible:

- Only when the capsule registered to originally does not have the Lifecycle Environments associated. 

Steps to Reproduce:

1. Deploy a Capsule

2. Capsule should not be associated with any lifecycles.

3. Register client to the Capsule using global registration template.

   The registration will report the following message but will be successful even though yum repositories reports 404.

   ~~~
   Validation failed: Content view environment content facets is invalid (HTTP error code 422: Unprocessable Entity)
   ~~~

   ~~~
   8  | client.example.com  | RedHat 8.7       |            | 10.10.180.1 | 92:fa:8c:47:dc:b9 | Warning       |              |                      
   ~~~

   ~~~
   Errors during downloading metadata for repository 'rhel-8-for-x86_64-baseos-rpms':
   - Status code: 404 for https://capsule.example.com/pulp/content/RedHat/Library/content/dist/rhel8/8/x86_64/baseos/os/repodata/repomd.xml (IP: 10.10.125.2)
   Error: Failed to download metadata for repo 'rhel-8-for-x86_64-baseos-rpms': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
   ~~~

4. Now, try to force register the client to Satellite using global registration template by using the Force option.


Actual results:

- The script unregisters the client successfully.

  ~~~
  Unregistering from: capsule.example.com:443/rhsm
  System has been unregistered.
  ~~~

  After this, it fails with following message. 

  ~~~
  Validation failed: Host client.example.com: Cannot add content view environment to content facet. The host's content source 'capsule.example.com' does not sync lifecycle environment 'Library'. (HTTP error code 422: Unprocessable Entity)
  ~~~

- Client can only be registered after removing the profile from the Satellite manually.


Expected results:

- Client should be re-registered to the Satellite. 

Additional info:

- This behavior is not present on 6.13. Force option can be used to register from Capsule to Satellite on 6.13.

Comment 1 Leos Stejskal 2023-07-18 11:41:33 UTC
> Capsule should not be associated with any lifecycles.

Why? Because of this registration is failing due to an error coming from RHEL:
>   Errors during downloading metadata for repository 'rhel-8-for-x86_64-baseos-rpms':
>   - Status code: 404 for https://capsule.example.com/pulp/content/RedHat/Library/content/dist/rhel8/8/x86_64/baseos/os/repodata/repomd.xml (IP: 10.10.125.2)
>   Error: Failed to download metadata for repo 'rhel-8-for-x86_64-baseos-rpms': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

This is not an issue in registration, but in not existing repository on capsule.

> This behavior is not present on 6.13.
Really? Do you have an environment where can I confirm it? From my understanding
registering to capsule without env/cv never worked before.

Comment 2 Manu Sunil 2023-07-18 12:02:23 UTC
Hello Leos,

The issue is not with the registration to the Capsule. Yes, it is expected that we get 404 error when when LCEs are not properly associated with the capsules.

The issue is when I try to re-register using the Force option on GRT to the Satellite after the above process.

For example, If I mistakenly choose a capsule without the correct lifecycle. The registration completes with `Validation failed` message and gives the 404 error(as expected).
Now, if I try to re-register the client to Satellite by generating a global registration script with Force(after changing the capsule option), it reports the 422 error.

Apologies, I don't have the setup readily available. I can reproduce the issue once again and share the setup here.

Regards,
Manu Sunil

Comment 4 Leos Stejskal 2023-08-01 05:58:30 UTC
I see. On that second capsule, is the Library environment synced there? See the error:

> Validation failed: Host client.example.com: Cannot add content view environment to content facet. The host's content source 'capsule.example.com' does not sync the lifecycle environment 'Library'. (HTTP error code 422: Unprocessable Entity)

Looks like you selected a capsule and environment which is not synced there. Try to remove the environment from the command and run it again.

Comment 5 Eric Helms 2024-06-06 16:24:46 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.