Bug 1994685 - satelite-change-hostname leaves old entry of Satellite server in "All Hosts" page after the renaming gets completed in Satellite 6.10
Summary: satelite-change-hostname leaves old entry of Satellite server in "All Hosts" ...
Keywords:
Status: NEW
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: satellite-change-hostname
Version: 6.10.0
Hardware: All
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: 2021-08-17 17:04 UTC by Sayan Das
Modified: 2023-07-21 21:06 UTC (History)
3 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-15077 0 None None None 2023-01-24 17:53:38 UTC

Description Sayan Das 2021-08-17 17:04:48 UTC
Description of problem:

satelite-change-hostname leaves old entry of Satellite server in "All Hosts" page after the renaming gets completed.


Version-Release number of selected component (if applicable):
Red Hat Satellite 6.10


How reproducible:

Always

Steps to Reproduce:

1. Install Satellite 6.10 with name satellite.example.com

2. Use --> satellite-change-hostname change.example.com -u admin -p XXXX

3. Once completed look at "Hosts --> All Hosts" page

Actual results:

It shows both old and new entry i.e. satellite.example.com as well as change.example.com


Expected results:

* Old entry should get removed automatically.

* If above is not possible, then we need to include an additional step in documentation to do so i.e. removal of old entry manually.


Additional info:

* This is not applicable if we are renaming a capsule server. I don't see this behavior there.

Comment 1 Brad Buckingham 2021-08-19 14:43:53 UTC
Is this a regression from Satellite 6.9?

Comment 2 Sayan Das 2021-08-19 14:49:38 UTC
I cannot confirm that but I will say that part of the code was probably missing always.

Let me check that real quick and get back to you on that.

Comment 3 Sayan Das 2021-08-19 14:56:41 UTC
Hello Brad,

I could not check practically but It seems, for Satelite 6.9 also the same issue should persist.

I can see the only change in code is following and based on that I would say, satellite-change-hostname always had this missing but it was never reported. 


--- hostname-change.rb_fromsat69	2021-02-11 07:12:29.000000000 -0500
+++ hostname-change.rb_fromsat610	2021-08-19 10:51:05.825675017 -0400
@@ -212,6 +212,8 @@
     end
 
     def delete_puppet_certs
+      return unless @scenario_answers['puppet'].is_a?(Hash)
+
       puppet_ssldir = @scenario_answers['puppet']['ssldir']
 
       run_cmd("rm -rf '#{puppet_ssldir}'")
@@ -495,9 +497,14 @@
       STDOUT.puts "updating hostname in foreman installer scenarios"
       self.run_cmd("sed -i -e 's/#{@old_hostname}/#{@new_hostname}/Ig' #{scenarios_path}/*.yaml")
 
-      STDOUT.puts "updating hostname in hammer configuration"
-      self.run_cmd("sed -i.bak -e 's/#{@old_hostname}/#{@new_hostname}/Ig' #{hammer_root_config_path}/*.yml")
-      self.run_cmd("sed -i.bak -e 's/#{@old_hostname}/#{@new_hostname}/Ig' #{hammer_config_path}/*.yml")
+      if File.exist?(hammer_root_config_path) or File.exist?(hammer_config_path)
+        STDOUT.puts "updating hostname in hammer configuration"
+        [hammer_root_config_path, hammer_config_path].each do |config_dir|
+          Dir[File.join(config_dir, "*.yml")].each do |config_file|
+            self.run_cmd("sed -i.bak -e 's/#{@old_hostname}/#{@new_hostname}/Ig' #{config_file}")
+          end
+        end
+      end
 
       if File.exist?(last_scenario_yaml)
         STDOUT.puts 'backing up last_scenario.yaml'

Comment 6 Brad Buckingham 2023-07-21 21:06:39 UTC
Upon review of our valid but aging backlog the Satellite Team has concluded that this Bugzilla does not meet the criteria for a resolution in the near term, and are planning to close in a month. This message may be a repeat of a previous update and the bug is again being considered to be closed. If you have any concerns about this, please contact your Red Hat Account team.  Thank you.


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