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 1829115

Summary: satellite-change-hostname fails to rename Red Hat Satellite Capsule server 6.7
Product: Red Hat Satellite Reporter: Sayan Das <saydas>
Component: satellite-change-hostnameAssignee: wclark
Status: CLOSED ERRATA QA Contact: Peter Ondrejka <pondrejk>
Severity: high Docs Contact:
Priority: high    
Version: 6.7.0CC: ahumbe, alsouza, aruzicka, desingh, egolov, gscarbor, inecas, ktordeur, wclark
Target Milestone: 6.10.0Keywords: PrioBumpGSS, Regression, Triaged
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: katello-4.1.0-0.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-16 14:09:12 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 2020-04-28 22:22:18 UTC
Description of problem:
satellite-change-hostname fails to rename Red Hat Satellite Capsule server 6.7 


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


How reproducible:
Always


Steps to Reproduce:
1. Follow the steps mentioned in https://access.redhat.com/documentation/en-us/red_hat_satellite/6.6/html/administering_red_hat_satellite/sect-red_hat_satellite-administering_red_hat_satellite-renaming_a_server#sect-Red_Hat_Satellite-Administering_Red_Hat_Satellite-Renaming_a_Capsule_Server 



Actual results:


[root@scapsule ~]#  satellite-change-hostname newcapsule.example.com --username admin --password Redhat1! --certs-tar /root/newcapsule.example.com-certs.tar 
Checking for certs tarball

Checking hostname validity

***WARNING*** This script will modify your system.
You will need to re-register any foreman clients registered to this system after script completion.
 Have you taken the necessary precautions (backups, snapshots, etc...)?
Proceed with changing your hostname? [y/n]
y
Precheck passed
updating hostname in /etc/hostname
setting hostname
checking if hostname was changed
stopping services
removing old cert rpms
No Match for argument: capsule.example.com-foreman-client*
No Match for argument: capsule.example.com-tomcat*
deleting old certs
backed up /var/www/html/pub to /var/www/html/pub/capsule.example.com-20200428143308.backup
updating hostname in /etc/hosts
updating hostname in foreman installer scenarios
updating hostname in hammer configuration
sed: can't read /root/.hammer/cli.modules.d/*.yml: No such file or directory

Failed 'sed -i.bak -e 's/capsule.example.com/newcapsule.example.com/g' /root/.hammer/cli.modules.d/*.yml' with exit code 2



Expected results:

It should be getting completed without any errors.


Additional info:

It's happening because of the new changes introduced in "/usr/share/katello/hostname-change.rb" to update hammer configuration on Satellite but that breaks the process on capsule.
~~~
STDOUT.puts "updating hostname in hammer configuration"
self.run_cmd("sed -i.bak -e 's/#{@old_hostname}/#{@new_hostname}/g' #{hammer_root_config_path}/*.yml")
self.run_cmd("sed -i.bak -e 's/#{@old_hostname}/#{@new_hostname}/g' #{hammer_config_path}/*.yml")
~~~

If I comment on them at the beginning only, the satellite-change-hostname will be successful for capsule in one shot.

This piece of code is not present on earlier versions of Red Hat Satellite\Capsule.

Comment 8 Bryan Kearney 2021-03-18 16:40:44 UTC
Upstream bug assigned to wclark

Comment 9 Bryan Kearney 2021-03-18 16:40:45 UTC
Upstream bug assigned to wclark

Comment 10 Bryan Kearney 2021-03-22 16:02:41 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/32125 has been resolved.

Comment 12 Peter Ondrejka 2021-06-17 14:17:33 UTC
Verified in Satellite 6.10 snap 5, the "updating hostname in hammer configuration" is not triggered when renaming a capsule, but it is correctly triggered when renaming a satellite

Comment 16 errata-xmlrpc 2021-11-16 14:09:12 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 (Moderate: Satellite 6.10 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-2021:4702