Skip to content

Commit

Permalink
Fix setting persistent hostname on SLES guests.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsesh committed May 31, 2013
1 parent ccfd321 commit 497ebb0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/guests/suse/cap/change_host_name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def self.change_host_name(machine, name)
machine.communicate.tap do |comm|
# Only do this if the hostname is not already set
if !comm.test("sudo hostname | grep '#{name}'")
comm.sudo("sed -i 's/\\(HOSTNAME=\\).*/\\1#{name}/' /etc/sysconfig/network")
comm.sudo("echo #{name} > /etc/HOSTNAME")
comm.sudo("hostname #{name}")
comm.sudo("sed -i 's@^\\(127[.]0[.]0[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts")
end
Expand Down

0 comments on commit 497ebb0

Please sign in to comment.