Now checks if `unison` binary is installed before running

This commit is contained in:
Mitchell Hashimoto 2010-06-20 14:38:58 -07:00
parent e8fd57fbbb
commit 47403e16cc
3 changed files with 8 additions and 1 deletions

View File

@ -57,10 +57,10 @@ module Vagrant
def setup_unison def setup_unison
return if unison_folders.empty? return if unison_folders.empty?
logger.info "Setting up unison crontab..."
runner.ssh.execute do |ssh| runner.ssh.execute do |ssh|
runner.system.prepare_unison(ssh) runner.system.prepare_unison(ssh)
logger.info "Creating unison crontab entries..."
unison_folders.each do |name, data| unison_folders.each do |name, data|
runner.system.create_unison(ssh, data) runner.system.create_unison(ssh, data)
end end

View File

@ -53,6 +53,8 @@ module Vagrant
end end
def prepare_unison(ssh) def prepare_unison(ssh)
ssh.exec!("which unison", :error_key => :unison_not_found)
logger.info "Preparing system for unison sync..." logger.info "Preparing system for unison sync..."
vm.ssh.upload!(StringIO.new(TemplateRenderer.render('/unison/script')), config.unison.script) vm.ssh.upload!(StringIO.new(TemplateRenderer.render('/unison/script')), config.unison.script)
ssh.exec!("sudo chmod +x #{config.unison.script}") ssh.exec!("sudo chmod +x #{config.unison.script}")

View File

@ -212,6 +212,11 @@
:system_unspecified: |- :system_unspecified: |-
A VM system type must be specified! This is done via the `config.vm.system` A VM system type must be specified! This is done via the `config.vm.system`
configuration value. Please read the documentation online for more information. configuration value. Please read the documentation online for more information.
:unison_not_found: |-
The `unison` binary was not found on the guest machine. This is required
for folder syncing via unison. Please install unison on your system to
use folder syncing. You may also disable folder syncing, install unison,
re-enable syncing, then call a `vagrant reload` to enable syncing.
:unknown_vm: |- :unknown_vm: |-
The specified VM could not be found: <%= vm %> The specified VM could not be found: <%= vm %>
:virtualbox_import_failure: |- :virtualbox_import_failure: |-