Bug 2223415 - Force registering from a Capsule to the Satellite using global registration template fails with HTTP error code 422: Unprocessable Entity error
Summary: Force registering from a Capsule to the Satellite using global registration t...
Keywords:
Status: NEW
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Registration
Version: 6.14.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Satellite QE Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-07-17 18:09 UTC by Manu Sunil
Modified: 2023-08-03 17:09 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker SAT-19132 0 None None None 2023-07-25 11:04:10 UTC

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.


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