Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow hostnames to be subset of box name for Ubuntu

  • Loading branch information...
commit 625741ab6a9c46cef89e34063975be0eb1517dc4 1 parent 3c0341b
@mitchellh authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  plugins/guests/ubuntu/guest.rb
2  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")
Please sign in to comment.
Something went wrong with that request. Please try again.