Permalink
Browse files

Allow hostnames to be subset of box name for Ubuntu

  • Loading branch information...
1 parent 3c0341b commit 625741ab6a9c46cef89e34063975be0eb1517dc4 @mitchellh committed Oct 13, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 plugins/guests/ubuntu/guest.rb
@@ -26,7 +26,7 @@ def mount_nfs(ip, folders)
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")

0 comments on commit 625741a

Please sign in to comment.