Feature #20799
closedkatello-change-hostname needs better requirements checking
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1485884
Description of problem:
katello-change-hostname should check requirements before performing any changes on server. It should work in an "all or nothing" way, so if it does not have everything needed to complete successfully, it should do nothing.
Currently, the checking is done while making changes. Consider an example with invalid hostname:
~]# katello-change-hostname 9899.$ -u admin -p changeme
This will modify your system. You will need to re-register any Foreman Proxies and Foreman clients after script completion. Foreman Proxies will have to be reinstalled. If you are using custom certificates, you will have to run the foreman-installer again with custom certificate options after this script completes. Have you taken the necessary precautions (backups, snapshots, etc...) and want to proceed with changing your hostname? [y/n]:Updating default Foreman Proxy
Updating installation media paths
updating hostname in /etc/hostname
setting hostname
checking if hostname was changed
the new hostname was not changed successfully, exiting script
This seems correct, but when checking the hostname, we can see it was actually changed:
~]# hostname
9899
~]# hostnamectl
Static hostname: 9899
Pretty hostname: 9899.$