VBoxManage errors show stderr

This commit is contained in:
Mitchell Hashimoto 2013-03-31 20:45:54 -07:00
parent 4f1a3dad8c
commit bc2a9fe780
3 changed files with 19 additions and 6 deletions

View File

@ -9,6 +9,8 @@ IMPROVEMENTS:
- Vagrant will detect Bundler environments, make assumptions that you're
developing plugins, and will quiet its error output a bit.
- More comprehensive synced folder configuration validation.
- VBoxManage errors now show the output from the command so that
users can potentially know what is wrong.
BUG FIXES:

View File

@ -279,6 +279,9 @@ module VagrantPlugins
# Variable to store our execution result
r = nil
# If there is an error with VBoxManage, this gets set to true
errored = false
retryable(:on => Vagrant::Errors::VBoxManageError, :tries => tries, :sleep => 1) do
# Execute the command
r = raw(*command, &block)
@ -294,7 +297,7 @@ module VagrantPlugins
# This is usually indicative of a corrupted VirtualBox install.
raise Vagrant::Errors::VBoxManageNotFoundError
else
raise Vagrant::Errors::VBoxManageError, :command => command.inspect
errored = true
end
else
# Sometimes, VBoxManage fails but doesn't actual return a non-zero
@ -302,11 +305,19 @@ module VagrantPlugins
# occurred.
if r.stderr =~ /VBoxManage: error:/
@logger.info("VBoxManage error text found, assuming error.")
raise Vagrant::Errors::VBoxManageError, :command => command.inspect
errored = true
end
end
end
# If there was an error running VBoxManage, show the error and the
# output.
if errored
raise Vagrant::Errors::VBoxManageError,
:command => command.inspect,
:stderr => r.stderr
end
# Return the output, making sure to replace any Windows-style
# newlines with Unix-style.
r.stdout.gsub("\r\n", "\n")

View File

@ -386,12 +386,12 @@ en:
%{file}
vboxmanage_error: |-
There was an error executing the following command with VBoxManage:
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
%{command}
Command: %{command}
For more information on the failure, enable detailed logging by setting
the environment variable VAGRANT_LOG to DEBUG.
Stderr: %{stderr}
vboxmanage_not_found_error: |-
The "VBoxManage" command or one of its dependencies could not
be found. Please verify VirtualBox is properly installed. You can verify