Merge pull request #1781 from dsesh/patch-1

Fix setting persistent hostname on SLES guests.
This commit is contained in:
Mitchell Hashimoto 2013-06-01 17:43:35 -07:00
commit c591adaffd
1 changed files with 1 additions and 1 deletions

View File

@ -6,7 +6,7 @@ module VagrantPlugins
machine.communicate.tap do |comm| machine.communicate.tap do |comm|
# Only do this if the hostname is not already set # Only do this if the hostname is not already set
if !comm.test("sudo hostname | grep '#{name}'") 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("hostname #{name}")
comm.sudo("sed -i 's@^\\(127[.]0[.]0[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts") comm.sudo("sed -i 's@^\\(127[.]0[.]0[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts")
end end