diff --git a/lib/vagrant/guest/debian.rb b/lib/vagrant/guest/debian.rb index 1b4b8cead..ca7158349 100644 --- a/lib/vagrant/guest/debian.rb +++ b/lib/vagrant/guest/debian.rb @@ -50,7 +50,7 @@ module Vagrant end def change_host_name(name) - if !vm.channel.test?("hostname --fqdn | grep '^#{name}$' || hostname --short | grep '^#{name}$'") + if !vm.channel.test("hostname --fqdn | grep '^#{name}$' || hostname --short | grep '^#{name}$'") vm.channel.sudo("sed -r -i 's/^(127[.]0[.]1[.]1[[:space:]]+).*$/\\1#{name} #{name.split('.')[0]}/' /etc/hosts") vm.channel.sudo("sed -i 's/.*$/#{name.split('.')[0]}/' /etc/hostname") vm.channel.sudo("hostname -F /etc/hostname")