Let users know we will attempt to remove symlinks, otherwise vagrant won't output anything prior to the warn

This commit is contained in:
Fabio Rehm 2013-10-17 14:04:09 -03:00
parent 199a14b61f
commit cfabddc7c8

View file

@ -13,10 +13,12 @@ module VagrantPlugins
@env = env @env = env
@machine = env[:machine] @machine = env[:machine]
if should_remove_symlinks? if symlinks.any?
env[:ui].info I18n.t('vagrant_cachier.cleanup') env[:ui].info I18n.t('vagrant_cachier.cleanup')
symlinks.each do |symlink| if sshable?
remove_symlink symlink symlinks.each do |symlink|
remove_symlink symlink
end
end end
File.delete @machine.data_dir.join('cache_dirs').to_s File.delete @machine.data_dir.join('cache_dirs').to_s
@ -25,12 +27,9 @@ module VagrantPlugins
@app.call env @app.call env
end end
def should_remove_symlinks?
@logger.info 'Checking if cache symlinks should be removed'
symlinks.any? && @machine.state.id == :running && sshable?
end
def sshable? def sshable?
return if @machine.state.id != :running
# By default Vagrant will keep trying [1] to ssh connect to the VM for # By default Vagrant will keep trying [1] to ssh connect to the VM for
# a long and we've got to prevent that from happening, so we just wait # a long and we've got to prevent that from happening, so we just wait
# a few seconds and assume that the VM is halted / unresponsive and we # a few seconds and assume that the VM is halted / unresponsive and we