diff --git a/lib/vagrant-hostmanager/action/update_hosts_file.rb b/lib/vagrant-hostmanager/action/update_hosts_file.rb index 593f0ed..761451e 100644 --- a/lib/vagrant-hostmanager/action/update_hosts_file.rb +++ b/lib/vagrant-hostmanager/action/update_hosts_file.rb @@ -39,9 +39,11 @@ module VagrantPlugins # copy the hosts file to each matching machine # TODO append hostname to loopback address matching_machines.each do |machine| - env[:ui].info @translator.t('update', { :name => machine.name }) - machine.communicate.upload(path, '/tmp/hosts') - machine.communicate.sudo("mv /tmp/hosts /etc/hosts") + if machine.communicate.ready? + env[:ui].info @translator.t('update', { :name => machine.name }) + machine.communicate.upload(path, '/tmp/hosts') + machine.communicate.sudo("mv /tmp/hosts /etc/hosts") + end end @app.call(env) diff --git a/lib/vagrant-hostmanager/version.rb b/lib/vagrant-hostmanager/version.rb index a4b4b02..0317228 100644 --- a/lib/vagrant-hostmanager/version.rb +++ b/lib/vagrant-hostmanager/version.rb @@ -1,5 +1,5 @@ module VagrantPlugins module HostManager - VERSION = '0.0.2' + VERSION = '0.0.3' end end diff --git a/test/test.sh b/test/test.sh index cf9569a..8e31350 100755 --- a/test/test.sh +++ b/test/test.sh @@ -5,6 +5,10 @@ echo "[server1] /etc/hosts file:" vagrant ssh server1 -c 'cat /etc/hosts' echo "[server2] /etc/hosts file:" vagrant ssh server2 -c 'cat /etc/hosts' + +vagrant halt +vagrant up + vagrant destroy server1 -f echo "[server2] /etc/hosts file:" vagrant ssh server2 -c 'cat /etc/hosts'