Bug 1861831

Summary: satellite-change-hostname cannot change the satellite hostname after failing.
Product: Red Hat Satellite Reporter: Rudnei Bertol Jr. <rbertolj>
Component: satellite-change-hostnameAssignee: Jeremy Lenz <jlenz>
Status: CLOSED ERRATA QA Contact: Peter Ondrejka <pondrejk>
Severity: medium Docs Contact:
Priority: high    
Version: 6.8.0CC: ahumbe, ehelms, jomitsch, jturel, kkulkarn, pcreech, pmoravec, swadeley
Target Milestone: 6.8.0Keywords: PrioBumpQA, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: katello-3.16.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-27 13:04:48 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 Rudnei Bertol Jr. 2020-07-29 16:50:28 UTC
Description of problem:

Satellite hostname change command fails to run on the second time, if the command failed for some reason on the first attempt.

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

6.8.0-beta

How reproducible:

Try to change the satellite hostname using the satellite-change-hostname after a failing on the first attempt.

Steps to Reproduce:
1. perform the satellite-change-hostname causing the failure, i.e. change for a hostname that cannot be resolved.
2. re-run the same command.


Actual results:

We cannot re-run the satellite-change-hostname if it has failed previsouly.

Expected results:

We should be able to re-run after fixing the previous error.

Additional info:

Following a reproducer for the error.

~~~ 
[root@dhcp181-132 ~]# satellite-change-hostname acme.gsslab.rdu2.redhat.com -u admin -p password
 
Checking hostname validity
 
Checking overall health of server
 
Checking credentials
 
***WARNING*** This script will modify your system.
You will need to re-register any foreman clients registered to this system after script completion.
Capsules will have to be re-registered and 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...)?
Proceed with changing your hostname? [y/n]
y
Precheck passed
updating hostname in /etc/hostname
setting hostname
checking if hostname was changed
 
Updating default Capsule
Updating installation media paths
stopping services
removing old cert rpms
No Match for argument: dhcp181-132.gsslab.rdu2.redhat.com-tomcat*
deleting old certs
backed up /var/www/html/pub to /var/www/html/pub/dhcp181-132.gsslab.rdu2.redhat.com-20200729100741.backup
updating hostname in /etc/hosts
updating hostname in foreman installer scenarios
updating hostname in hammer configuration
backing up last_scenario.yaml
removing last_scenario.yaml
re-running the installer
foreman-installer --scenario satellite -v --disable-system-checks --certs-regenerate=true --foreman-proxy-register-in-foreman true
Unable to resolve forward DNS for acme.gsslab.rdu2.redhat.com
restoring last_scenario.yaml
/usr/share/katello/hostname-change.rb:382:in `restore_last_scenario_yaml': undefined method `path' for nil:NilClass (NoMethodError)
        from /usr/share/katello/hostname-change.rb:533:in `block in run'
        from /usr/share/katello/helper.rb:59:in `run_cmd'
        from /usr/share/katello/hostname-change.rb:530:in `run'
        from /usr/sbin/satellite-change-hostname:23:in `<main>'
 
[root@dhcp181-132 ~]# satellite-change-hostname acme.gsslab.rdu2.redhat.com -u admin -p password
This utility can't run on a non-katello system.
~~~

Comment 1 Zach Huntington-Meath 2020-08-10 14:56:35 UTC
*** Bug 1866929 has been marked as a duplicate of this bug. ***

Comment 3 Peter Ondrejka 2020-09-03 08:51:22 UTC
Verified on Sat 6.8 snap 13, an unsuccessful attempt to change hostname with s-c-h no longer blocks subsequent attemtps

Comment 6 errata-xmlrpc 2020-10-27 13:04:48 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 (Important: Satellite 6.8 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-2020:4366