Catch and handle customization errors
This commit is contained in:
parent
e1d0ce19ce
commit
a3395f94ab
|
@ -18,7 +18,13 @@ module Vagrant
|
||||||
arg
|
arg
|
||||||
end
|
end
|
||||||
|
|
||||||
env[:vm].driver.execute_command(processed_command)
|
result = env[:vm].driver.execute_command(processed_command)
|
||||||
|
if result.exit_code != 0
|
||||||
|
raise Errors::VMCustomizationFailed, {
|
||||||
|
:command => processed_command.inspect,
|
||||||
|
:error => result.stderr
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ module Vagrant
|
||||||
|
|
||||||
# Executes a raw command.
|
# Executes a raw command.
|
||||||
def execute_command(command)
|
def execute_command(command)
|
||||||
execute(*command)
|
raw(*command)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Forwards a set of ports for a VM.
|
# Forwards a set of ports for a VM.
|
||||||
|
|
|
@ -334,6 +334,11 @@ module Vagrant
|
||||||
error_key(:no_base_mac, "vagrant.actions.vm.match_mac")
|
error_key(:no_base_mac, "vagrant.actions.vm.match_mac")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class VMCustomizationFailed < VagrantError
|
||||||
|
status_code(61)
|
||||||
|
error_key(:failure, "vagrant.actions.vm.customize")
|
||||||
|
end
|
||||||
|
|
||||||
class VMFailedToBoot < VagrantError
|
class VMFailedToBoot < VagrantError
|
||||||
status_code(21)
|
status_code(21)
|
||||||
error_key(:failed_to_boot, "vagrant.actions.vm.boot")
|
error_key(:failed_to_boot, "vagrant.actions.vm.boot")
|
||||||
|
|
|
@ -313,6 +313,16 @@ en:
|
||||||
clear_shared_folders:
|
clear_shared_folders:
|
||||||
deleting: Cleaning previously set shared folders...
|
deleting: Cleaning previously set shared folders...
|
||||||
customize:
|
customize:
|
||||||
|
failure: |-
|
||||||
|
A customization command failed:
|
||||||
|
|
||||||
|
%{command}
|
||||||
|
|
||||||
|
The following error was experienced:
|
||||||
|
|
||||||
|
%{error}
|
||||||
|
|
||||||
|
Please fix this customization and try again.
|
||||||
running: Running any VM customizations...
|
running: Running any VM customizations...
|
||||||
destroy:
|
destroy:
|
||||||
destroying: Destroying VM and associated drives...
|
destroying: Destroying VM and associated drives...
|
||||||
|
|
Loading…
Reference in New Issue