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.
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
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