Show an error message if ansible fails to run [GH-1699]

This commit is contained in:
Mitchell Hashimoto 2013-07-20 00:07:09 -04:00
parent 1841723478
commit eb70c0d6bb
4 changed files with 11 additions and 1 deletions

View File

@ -15,6 +15,7 @@ IMPROVEMENTS:
functionality removed in 1.1 from "config.dotfile_name" [GH-1524]
- Vagrant will show an error if VirtualBox 4.2.14 is running.
- Added provider to BoxNotFound error message. [GH-1692]
- If Ansible fails to run properly, show an error message. [GH-1699]
BUG FIXES:

View File

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

View File

@ -31,11 +31,13 @@ module VagrantPlugins
}
begin
Vagrant::Util::Subprocess.execute(*command) do |type, data|
exit_status = Vagrant::Util::Subprocess.execute(*command) do |type, data|
if type == :stdout || type == :stderr
@machine.env.ui.info(data, :new_line => false, :prefix => false)
end
end
raise Vagrant::Errors::AnsibleFailed if exit_status != 0
rescue Vagrant::Util::Subprocess::LaunchError
raise Vagrant::Errors::AnsiblePlaybookAppNotFound
end

View File

@ -106,6 +106,9 @@ en:
Machine name: %{name}
Active provider: %{active_provider}
Requested provider: %{requested_provider}
ansible_failed: |-
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
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