From 625741ab6a9c46cef89e34063975be0eb1517dc4 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 12 Oct 2012 20:06:54 -0700 Subject: [PATCH] Allow hostnames to be subset of box name for Ubuntu --- plugins/guests/ubuntu/guest.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/guests/ubuntu/guest.rb b/plugins/guests/ubuntu/guest.rb index ed4311cea..3d95d1c79 100644 --- a/plugins/guests/ubuntu/guest.rb +++ b/plugins/guests/ubuntu/guest.rb @@ -26,7 +26,7 @@ module VagrantPlugins def change_host_name(name) vm.communicate.tap do |comm| - if !comm.test("sudo hostname | grep '#{name}'") + if !comm.test("sudo hostname | grep '^#{name}$'") comm.sudo("sed -i 's/.*$/#{name}/' /etc/hostname") comm.sudo("sed -i 's@^\\(127[.]0[.]1[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts") comm.sudo("service hostname start")