Bug 1866929

Summary: Satellite Hostname Change fails due to an error causing incorrect update to /etc/hosts
Product: Red Hat Satellite Reporter: Kedar Kulkarni <kkulkarn>
Component: InstallationAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED DUPLICATE QA Contact: Devendra Singh <desingh>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.8.0CC: bherring, mshriver, swadeley, vijsingh, zhunting
Target Milestone: 6.8.0Keywords: PrioBumpQA, Regression, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-08-10 14:56:35 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 Kedar Kulkarni 2020-08-06 20:32:02 UTC
Created attachment 1710701 [details]
Log messages when /etc/hosts is modified

Description of problem:
When trying to change hostname of Satellite, it incorrectly modifies /etc/hosts as follows:

Original:
10.1.3.104 dhcp-3-57.vms.sat.rdu2.redhat.com dhcp-3-104.vms.sat.rdu2.redhat.com
Modified: 
10.1.3.104 dhcp-3-104.vms.sat.rdu2.redhat.com dhcp-3-104.vms.sat.rdu2.redhat.com



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

How reproducible:
100%

Steps to Reproduce:
1.Install Satellite 
2.Modify /etc/hosts by hand to include old hostname and new(desired) hostname as shown above in original section above. 
3.Run hostname change command. 

satellite-change-hostname <new-hostname> -u admin -p "changeme" -y

Actual results:

Failure, stderr:

No Match for argument: dhcp-3-140.vms.sat.rdu2.redhat.com-tomcat*
/usr/share/katello/hostname-change.rb:378: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>'

Expected results:
Hostname change should succeed without errors.

Additional info:
As I stated earlier, /etc/hosts file gets modified in the process of hostname change and that seems to be a possible reason for failure or related to failure somehow.

Comment 3 Zach Huntington-Meath 2020-08-10 14:56:35 UTC

*** This bug has been marked as a duplicate of bug 1861831 ***