From 9ca6fbe8f4fc1f500798067dbcf2d29f1b5bfd2c Mon Sep 17 00:00:00 2001 From: Elliot Segler Date: Sun, 6 Oct 2013 15:33:00 +0800 Subject: [PATCH] Hostname and FQDN should be done in one line --- plugins/guests/ubuntu/cap/change_host_name.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/guests/ubuntu/cap/change_host_name.rb b/plugins/guests/ubuntu/cap/change_host_name.rb index 6363ab732..26526fb08 100644 --- a/plugins/guests/ubuntu/cap/change_host_name.rb +++ b/plugins/guests/ubuntu/cap/change_host_name.rb @@ -21,10 +21,8 @@ module VagrantPlugins # hosts should resemble: # 127.0.1.1 host.fqdn.com host - # First to set fqdn - comm.sudo("sed -i 's@#{old}@#{name}@' /etc/hosts") - # Second to set hostname - comm.sudo("sed -i 's@#{old.split('.')[0]}@#{name.split('.')[0]}@' /etc/hosts") + # Set FQDN, hostname in one line + comm.sudo("sed -i 's@#{old}@#{name} #{name.split('.')[0]}@' /etc/hosts") if comm.test("[ `lsb_release -c -s` = hardy ]") # hostname.sh returns 1, so I grep for the right name in /etc/hostname just to have a 0 exitcode