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 1994685

Summary: satelite-change-hostname leaves old entry of Satellite server in "All Hosts" page after the renaming gets completed in Satellite 6.10
Product: Red Hat Satellite Reporter: Sayan Das <saydas>
Component: InstallationAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED WONTFIX QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.10.0CC: ahumbe, dsynk, ehelms
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: All   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-04-18 13:02:21 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 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.

Comment 8 Brad Buckingham 2023-09-01 19:42:20 UTC
Based upon feedback during auto-closure, leaving this bugzilla open a while longer for additional investigation; however, it may be closed in a future iteration.