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 2155083 - "change Puppet Master" option does not work in v6.10/v6.11
Summary: "change Puppet Master" option does not work in v6.10/v6.11
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Puppet
Version: 6.10.0
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: 6.15.0
Assignee: satellite6-bugs
QA Contact: Gaurav Talreja
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-12-19 22:44 UTC by tharring
Modified: 2024-04-23 17:13 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2024-04-23 17:12:58 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 36955 0 Normal Ready For Testing Revert back 'Change Puppet CA' action 2023-11-29 10:12:35 UTC
Github theforeman foreman pull 9932 0 None open Fixes #36955 - Revert back 'Change Puppet CA' action 2023-11-29 10:12:35 UTC
Red Hat Issue Tracker SAT-21002 0 None None None 2023-10-27 10:29:50 UTC
Red Hat Product Errata RHSA-2024:2010 0 None None None 2024-04-23 17:13:00 UTC

Description tharring 2022-12-19 22:44:28 UTC
Description of problem:
Web UI, Hosts, All Hosts, Select target hosts, Down Arrow next to 'Select Action', change Puppet Master and Select Clear Puppet CA exist in v6.10/6.11, but it will prompt a dialog and spin forever because of the missing path error.

Version-Release number of selected component (if applicable):
v6.10/v6.11


How reproducible:
Always

Additional info:
From Hao's notes:
~~~
Even before disabling the foreman_puppet plugin in Satellite 6.10/6.11, "change Puppet Master" option exists but it doesn't work. After pressing the "change Puppet Master", it will prompt a dialog and spin forever because of the missing path error. Need to raise a bugzilla for this if not any is raised yet.


production.log error


2022-12-16T11:02:52 [I|app|cc3a5bd2]   Rendering hosts/select_multiple_puppet_proxy.html.erb within layouts/application
2022-12-16T11:02:52 [I|app|cc3a5bd2]   Rendered hosts/_selected_hosts.html.erb (Duration: 16.6ms | Allocations: 5533)
2022-12-16T11:02:52 [I|app|cc3a5bd2]   Rendered hosts/select_multiple_puppet_proxy.html.erb within layouts/application (Duration: 479.7ms | Allocations: 46616)
2022-12-16T11:02:52 [W|app|cc3a5bd2] undefined method `update_multiple_puppet_proxy_hosts_path' for #<#<Class:0x000000001c5e07d8>:0x000000001bbe3c58>
 cc3a5bd2 | Did you mean?  update_multiple_puppet_ca_proxy_hosts_path
 cc3a5bd2 |                update_multiple_puppet_ca_proxy_hosts_url
 cc3a5bd2 |                update_multiple_openscap_proxy_hosts_path
 cc3a5bd2 |                update_multiple_owner_hosts_path
 cc3a5bd2 |                update_multiple_power_state_hosts_path
 cc3a5bd2 |                update_multiple_hostgroup_hosts_path
 cc3a5bd2 |                update_multiple_parameters_hosts_path
 cc3a5bd2 |                update_multiple_location_hosts_path
~~~

Current workaround:
~~~

1) Please take a backup or a snapshot of the Satellite

2) Identify the value of the puppet_ca_proxy_id and the puppet_proxy_id, replacing ch1.example.com with your host that uses the old puppet reference

  # su - postgres -c "psql -x -d foreman -c \"select name, puppet_proxy_id, puppet_ca_proxy_id from hosts where name like 'ch1.example.com'\""

3) Identify the name of the puppet proxy that is no longer running, replacing id=1 to match the id of the puppet_proxy_id returned from the first sql query

  # su - postgres -c "psql -x -d foreman -c \"select name, id from smart_proxies where id=1\""
  
4) Find all hosts using this puppet proxy, and set their values to nil.

   a) Assign the puppet proxy id to 'id' variable, replacing <ID> with puppet_proxy_id
      
      # id=<ID>
      # echo $id
      
   b) Run the below script on the Satellite (except ~~~ in the begging and the end) 
      ~~~
      foreman-rake console << RAKESCRIPT
      hosts=::Host.where(puppet_proxy_id: $id)
      hosts.each do |host|
        p "Updating puppet proxy for host: #{host.name}"
        host.update_attribute(:puppet_proxy_id, nil)
        host.update_attribute(:puppet_ca_proxy_id, nil)
      end; nil
      RAKESCRIPT
      ~~~

~~~

Comment 1 Ron Lavi 2023-01-15 11:08:12 UTC
Created redmine issue https://projects.theforeman.org/issues/35949 from this bug

Comment 2 Bryan Kearney 2023-03-03 12:03:20 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/35949 has been resolved.

Comment 5 Gaurav Talreja 2023-11-11 00:25:53 UTC
Hi Ron,

I tried reproducing this on Satellite 6.12.5 where this fix isn't present as you've mentioned, change_puppet_master gets stuck there and we see mentioned output in production logs, but along with it I've observed one more option change_puppet_ca, which seem to be missing in stream snaps
Earlier, change_puppet_master and change_puppet_ca option changes puppet_proxy_id and puppet_ca_proxy_id respectively, but now change_puppet_master changes both puppet_proxy_id and puppet_ca_proxy_id at same time and change_puppet_ca is missing, so just want to confirm, shouldn't we keep both options available for hosts?

Thanks,
Gaurav

Comment 7 Ewoud Kohl van Wijngaarden 2023-11-14 11:47:42 UTC
(In reply to Gaurav Talreja from comment #5)
> I tried reproducing this on Satellite 6.12.5 where this fix isn't present as
> you've mentioned, change_puppet_master gets stuck there and we see mentioned
> output in production logs, but along with it I've observed one more option
> change_puppet_ca, which seem to be missing in stream snaps
> Earlier, change_puppet_master and change_puppet_ca option changes
> puppet_proxy_id and puppet_ca_proxy_id respectively, but now
> change_puppet_master changes both puppet_proxy_id and puppet_ca_proxy_id at
> same time and change_puppet_ca is missing, so just want to confirm,
> shouldn't we keep both options available for hosts?

Yes we should have both. It's a valid setup to have your Satellite configured as the Puppet CA but a Capsule as the Puppetserver.

Comment 8 Gaurav Talreja 2023-11-15 09:19:51 UTC
Yes, You're right, I was thinking the same way about the setup, but as this option is missing now, so should we move this to ASSIGNED/FailedQA?

Also, looking at the linked PRs we moved `app/views/hosts/select_multiple_puppet_proxy.html.erb` from foreman core to foreman_puppet, but we also removed `app/helpers/puppet_related_helper.rb` from foreman but it wasn't added to foreman_puppet, so just guessing if this is what is causing it?

Comment 14 Leos Stejskal 2023-11-23 13:13:00 UTC
Hi Gaurav,
I have an upstream fix for the problem with missing action,
can you try it on stream and verify that it works as expected?

https://github.com/theforeman/foreman_puppet/pull/376

Comment 15 Gaurav Talreja 2023-11-24 15:15:15 UTC
Hey Leos, 
Yes, this PR appears to be closed, let me know if you open any other PRs and I will be happy to assist with testing.

Comment 16 Leos Stejskal 2023-11-29 10:12:36 UTC
New PR in core: https://github.com/theforeman/foreman/pull/9932

Comment 17 Gaurav Talreja 2023-12-01 08:54:02 UTC
I've tested the above PR from core and it works, Change Puppet CA option is back and it works to set only Puppet CA Capsule for selected hosts

But with Change Puppet Master option I've observed it changes both Puppet Capsule and Puppet CA Capsule at the same time, which isn't intended I guess, so not sure if this is due to this changes?

Comment 18 Leos Stejskal 2023-12-01 09:39:36 UTC
https://github.com/theforeman/foreman/pull/9932 has been merged

Comment 19 Ewoud Kohl van Wijngaarden 2024-01-17 16:24:48 UTC
(In reply to Gaurav Talreja from comment #17)
> I've tested the above PR from core and it works, Change Puppet CA option is
> back and it works to set only Puppet CA Capsule for selected hosts
> 
> But with Change Puppet Master option I've observed it changes both Puppet
> Capsule and Puppet CA Capsule at the same time, which isn't intended I
> guess, so not sure if this is due to this changes?

I saw the same thing, and was also confused. I thought it was me doing something wrong in my hacked up test environment, but I don't think this is how it's supposed to work. Though I think later I couldn't reproduce it anymore. Perhaps it has something to do with fields being empty.

However, from reading the code I can't really explain why.

Comment 21 Ewoud Kohl van Wijngaarden 2024-02-02 14:23:22 UTC
Testing this I can see a few things.

First scenario:

* Host has no Puppet Capsule and no Puppet CA Capsule
* Go to All Hosts
* Select Host
* Use Assign Puppet master bulk action
* Select one server (either Satellite or Capsule)
* Submit

Actual result:

* The host has the desired Puppet Capsule
* The host also has a Puppet CA Capsule

Now I can see some logic for there always being a Puppet CA Capsule set if the Puppet Capsule is set. I just can't find the code for it.

Second scenario

* Host has a Puppet Capsule set
* Go to All Hosts
* Select Host
* Use Assign Puppet master bulk action
* Select *Clear Puppet Capsule*
* Submit

Actual result:

The submit button is disabled. The *Clear Puppet Capsule* option is preselected. I can set it to some other value and select it back. Then submit is enabled and I can perform the action.

When I submit, the Host no longer has a Puppet Capsule set. It still has the Puppet CA Capsule set.

Third scenario I can't test now:

* The host has no Puppet Capsule set but Puppet CA Capsule set to some Puppet CA Capsule (like a Capsule)

Then use the bulk action to set the Puppet Capsule to some other value (like the Satellite).

I'd want this to only set the Puppet CA Capsule, but don't change the Puppet CA Capsule.

If that last scenario passes then I'd consider this as verified. The broken submit button on clear can be considered a separate bug that probably was already present prior to this.

Comment 22 Gaurav Talreja 2024-02-07 14:04:25 UTC
Yes, Thanks for confirming, I've also tried this scenarios on Satellite 6.15, and with this scenarios here are my observations,

With first scenario, here "change Puppet Master" option changes both Puppet Capsule and Puppet CA Capsule at same time, which I'm not sure if is expected, and it notifies that only puppet capsule changed always like "The Puppet Capsule of the selected hosts was set to sat.example.com", doesn't mention about Puppet CA Capsule field update here, reported BZ to track it separately https://bugzilla.redhat.com/show_bug.cgi?id=2263190

With second scenario, Yes, submit button is disabled here for preselected *Clear Puppet Capsule* or *Clear Puppet CA Capsule* options from the dropdown of Change Puppet Master or Change Puppet CA bulk actions, reported BZ to track it separately https://bugzilla.redhat.com/show_bug.cgi?id=2263188

With third scenario, I used additional Puppet-enabled Capsule with Satellite, 
- Tried "change Puppet Master" option for Satellite which changed both fields to Satellite as mentioned in first scenario.
- Tried "Change Puppet CA" option to Capsule which changed only Puppet CA Capsule field to Capsule, (also tried this bulk action first when Host has no Puppet Capsule and no Puppet CA Capsule)
- After this again tried "change Puppet Master" option, so when we've both Puppet Capsule and Puppet CA Capsule fields set already on host, and if we try "change Puppet Master" option then it only changes Puppet Capsule field for host, but no change to Puppet CA Capsule field as expected.

Therefore, I think we're good to verify this BZ. Verified on Satellite 6.15.0 Snap 8.0

Comment 25 errata-xmlrpc 2024-04-23 17:12:58 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 (Important: Satellite 6.15.0 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-2024:2010


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