Check if machines are ready for SSH communication.
This commit is contained in:
parent
e08fc6a811
commit
5865b1ac27
|
@ -39,10 +39,12 @@ module VagrantPlugins
|
||||||
# copy the hosts file to each matching machine
|
# copy the hosts file to each matching machine
|
||||||
# TODO append hostname to loopback address
|
# TODO append hostname to loopback address
|
||||||
matching_machines.each do |machine|
|
matching_machines.each do |machine|
|
||||||
|
if machine.communicate.ready?
|
||||||
env[:ui].info @translator.t('update', { :name => machine.name })
|
env[:ui].info @translator.t('update', { :name => machine.name })
|
||||||
machine.communicate.upload(path, '/tmp/hosts')
|
machine.communicate.upload(path, '/tmp/hosts')
|
||||||
machine.communicate.sudo("mv /tmp/hosts /etc/hosts")
|
machine.communicate.sudo("mv /tmp/hosts /etc/hosts")
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@app.call(env)
|
@app.call(env)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module HostManager
|
module HostManager
|
||||||
VERSION = '0.0.2'
|
VERSION = '0.0.3'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,10 @@ echo "[server1] /etc/hosts file:"
|
||||||
vagrant ssh server1 -c 'cat /etc/hosts'
|
vagrant ssh server1 -c 'cat /etc/hosts'
|
||||||
echo "[server2] /etc/hosts file:"
|
echo "[server2] /etc/hosts file:"
|
||||||
vagrant ssh server2 -c 'cat /etc/hosts'
|
vagrant ssh server2 -c 'cat /etc/hosts'
|
||||||
|
|
||||||
|
vagrant halt
|
||||||
|
vagrant up
|
||||||
|
|
||||||
vagrant destroy server1 -f
|
vagrant destroy server1 -f
|
||||||
echo "[server2] /etc/hosts file:"
|
echo "[server2] /etc/hosts file:"
|
||||||
vagrant ssh server2 -c 'cat /etc/hosts'
|
vagrant ssh server2 -c 'cat /etc/hosts'
|
||||||
|
|
Loading…
Reference in New Issue