Allow hostnames to be subset of box name for Ubuntu
This commit is contained in:
parent
3c0341b7be
commit
625741ab6a
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue