Bug 1829115 - satellite-change-hostname fails to rename Red Hat Satellite Capsule server 6.7
Summary: satellite-change-hostname fails to rename Red Hat Satellite Capsule server 6.7
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: satellite-change-hostname
Version: 6.7.0
Hardware: All
OS: Linux
high
high
Target Milestone: 6.10.0
Assignee: wclark
QA Contact: Peter Ondrejka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-04-28 22:22 UTC by Sayan Das
Modified: 2024-03-25 15:52 UTC (History)
9 users (show)

Fixed In Version: katello-4.1.0-0.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-16 14:09:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 32125 0 High Closed change-hostname fails when hammer is not present 2021-09-28 11:40:52 UTC
Red Hat Knowledge Base (Solution) 6065541 0 None None None 2021-05-20 17:03:15 UTC
Red Hat Product Errata RHSA-2021:4702 0 None None None 2021-11-16 14:09:31 UTC

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


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