Nicer error if ansible-playbook is not installed on the host

This commit is contained in:
Mitchell Hashimoto 2013-04-04 13:58:33 -07:00
parent 783cb4cf70
commit 1957efb4e1
3 changed files with 19 additions and 3 deletions

View File

@ -87,6 +87,10 @@ module Vagrant
error_key(:active_machine_with_different_provider)
end
class AnsiblePlaybookAppNotFound < VagrantError
error_key(:ansible_playbook_app_not_found)
end
class BaseVMNotFound < VagrantError
error_key(:base_vm_not_found)
end

View File

@ -30,10 +30,14 @@ module VagrantPlugins
:notify => [:stdout, :stderr]
}
Vagrant::Util::Subprocess.execute(*command) do |type, data|
if type == :stdout || type == :stderr
@machine.env.ui.info(data.chomp, :prefix => false)
begin
Vagrant::Util::Subprocess.execute(*command) do |type, data|
if type == :stdout || type == :stderr
@machine.env.ui.info(data.chomp, :prefix => false)
end
end
rescue Vagrant::Util::Subprocess::LaunchError
raise Vagrant::Errors::AnsiblePlaybookAppNotFound
end
end
end

View File

@ -66,6 +66,14 @@ en:
Machine name: %{name}
Active provider: %{active_provider}
Requested provider: %{requested_provider}
ansible_playbook_app_not_found: |-
The "ansible-playbook" program could not be found! Please verify
that "ansible-playbook" is available on the PATH of your host
system, and try again.
If you haven't installed Ansible yet, please install Ansible
on your system. Vagrant can't do this for you in a safe, automated
way. Please see ansible.cc for more info.
base_vm_not_found: The base VM with the name '%{name}' was not found.
batch_multi_error: |-
An error occurred while executing multiple actions in parallel.