Check if machines are ready for SSH communication.

This commit is contained in:
Shawn Dahlen 2013-04-04 16:52:12 -04:00
parent e08fc6a811
commit 5865b1ac27
3 changed files with 10 additions and 4 deletions

View File

@ -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)

View File

@ -1,5 +1,5 @@
module VagrantPlugins
module HostManager
VERSION = '0.0.2'
VERSION = '0.0.3'
end
end

View File

@ -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'