Bug 2123975 - The "Change Content Source" option does not changes the "registered_through" capsule in katello_subscription_facets of the host in Satellite 6.12
Summary: The "Change Content Source" option does not changes the "registered_through" ...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Registration
Version: 6.12.0
Hardware: All
OS: All
high
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Sam Bible
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-09-03 16:24 UTC by Sayan Das
Modified: 2023-01-04 08:01 UTC (History)
6 users (show)

Fixed In Version: tfm-rubygem-katello-4.5.0.17-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-01-04 07:51:24 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 35548 0 High Ready For Testing The "Change Content Source" feature does not changes the "registered_through" proxy 2022-09-23 13:47:29 UTC
Red Hat Issue Tracker SAT-12793 0 None None None 2022-09-07 14:50:17 UTC
Red Hat Issue Tracker SAT-13078 0 None None None 2022-09-27 16:16:25 UTC
Red Hat Issue Tracker SAT-14033 0 None None None 2023-01-04 08:01:33 UTC

Description Sayan Das 2022-09-03 16:24:19 UTC
Description of problem:

The "Change Content Source" option works great and switches a selected host to get subscriptions\content from a new capsule.

It indeed changes the Content Source of the host, but It does not updates the registered_through capsule in the subscription_facet of the host.

This creates problems with the selection of remote execution capsule when "Prefer registered through proxy for remote execution" is enabled.


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

Satellite 6.12


How reproducible:

Always


Steps to Reproduce:

1. Install Satellite 6.12 and an external Capsule 6.12

2. Administer --> Settings --> Content and enable the "Prefer registered through proxy for remote execution" option. 

3. Register a system with a satellite server using the global registration method ( pull provider enabled/disabled as you wish )

4. Ensure that remote-execution related options are properly configured in Satellite settings ( as per the requirement of the infra ).

5. Run "uptime" command via REX Script job on the host. Once the job finishes click on the name of the host and it will show that,  Satellite tried to execute the job directly on the host as expected.

6. Check the output of this command on satellite and note that registered_through column has the FQDN of satellite for the host.

# echo "select h.name,ksf.registered_through,ksf.last_checkin from hosts as h, katello_subscription_facets as ksf where h.id=ksf.host_id order by ksf.last_checkin" | su - postgres -c "psql foreman"


7. Now Go to the New Hosts UI and use the "Change Content Source" option to switch the host content source to external Capsule. Ensure to run the suggested REX job to configure the host OS (rhsm.conf) for the new capsule as well.

8. Edit the Host and ensure that the content source has changed to the external capsule.

9. Repeat Step 5 i.e. try running another "uptime" REX job and click on the hostname.

10. Repeat Step 6.



Actual results:

Step 9 will show that satellite is still trying to execute the job from it's own internal smart-proxy whereas expected it, the job should run via external capsule.

Step 10 will show that the registered_through column still has the FQDN of the satellite for the host and hence honoring the settings "Prefer registered through proxy for remote execution" satellite tried to execute the job on the host by itself.


Expected results:


For the completeness of the process and keeping in mind that we have an option like "Prefer registered through proxy for remote execution" present, The "Change Content Source" option should change the capsule entry in subscription_facet of the host as well for the registered_through column.


Additional info:

I only explained this via one satellite and one capsule but assume the same is happening for hosts switching from one capsule to another capsule and the "Prefer registered through proxy for remote execution" option is enabled.

From what I see, the satellite gives the first preference to registered_through capsule if "Prefer registered through proxy for remote execution" is enabled, when it comes to the selection of a remote-execution-capsule.

Comment 1 Sayan Das 2022-09-04 08:07:21 UTC
I noticed that registered_through capsule gets updated for the host but later when the next rhsmcertd auto_checkin happens on the host itself. 

So perhaps this is why we don't try to make the changes in DB manually for "registered_through" facet ?

Comment 4 Leos Stejskal 2022-09-21 12:47:13 UTC
Created redmine issue https://projects.theforeman.org/issues/35548 from this bug

Comment 5 Leos Stejskal 2022-09-21 13:33:18 UTC
I agree this needs to be fixed, I'll take a look,
however it's not blocking the feature and we have only few days before the freeze,
so I suggest to remove it from the 6.12 scope and fix it in upcoming release.

Comment 9 Bryan Kearney 2022-09-27 16:04:17 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/35548 has been resolved.

Comment 12 Danny Synk 2022-10-27 15:46:49 UTC
Failed QA on Satellite and Capsule 6.12, snap 15 (rubygem-katello-4.5.0.20-1.el8sat.noarch).

Steps to Test:
1. Deploy Satellite and Capsule and configure Capsule with a default certificate.
2. In the Satellite webUI, navigate to Administer > Settings > Content and change the value of the 'Prefer registered through Capsule for remote execution' to 'Yes'.
3. Register a RHEL host to the Satellite.
4. Copy the foreman-proxy public keys from both the Satellite and the Capsule to the RHEL host.
5. Execute a remote job on the RHEL host. When the job succeeds, click the name of the host on the job invocation page. Note the hostname of the Capsule that the job used.
6. In the foreman postgres database, check the value of the `registered_through` column for the host on the `katello_subscription_facets` table.
7. In the webUI, navigate to Hosts > All Hosts > [hostname] for the host.
8. Select the 'Change Content Source' action and set the content source to the external Capsule.
9. Edit the host and select the 'Content' tab. Verify that the external Capsule is set as the content source.
10. Repeat steps 5 and 6.

Actual Results:
The remote job is executed by the Satellite, regardless of which Capsule is set as the content source for the host. Changing the content source does not change the value of `registered_through` for the host on the `katello_subscription_facets` table.

Expected Results:
The remote job is executed by the Capsule that is currently set as the content source for the host. Changing the content source changes the value of `registered_through` for the host on the `katello_subscription_facets` table to match the content source.

Comment 15 Leos Stejskal 2022-11-29 08:03:02 UTC
Hi Danny,
did you test it with remote execution set as pull provider or with the default one (push)?

From what I've seen, the problem may be in the missing cherry-pick [0] in the SATELLITE-12 branch,
however this is fixing only pull provider.

Do you have same issues whit remote execution set as push provider?

[0] https://github.com/theforeman/foreman/pull/9435/commits/348730653bcaceb2bddb2110ae44fd98dadcdbf7

Comment 16 Danny Synk 2022-11-29 15:31:04 UTC
Hi Leos,

I tested this with the default push provider. I did not test it with the pull provider. So yes, this issue is present with remote execution set to use the push provider.

Comment 17 Leos Stejskal 2023-01-04 07:51:24 UTC
As per discussion closing as not a bug,
let's continue in https://bugzilla.redhat.com/show_bug.cgi?id=2151935


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