When recovering on import and destroying, force it

This commit is contained in:
Mitchell Hashimoto 2012-12-22 22:43:35 -08:00
parent dffbf6eb09
commit 66849fda20
2 changed files with 7 additions and 4 deletions

View File

@ -5,10 +5,11 @@ module VagrantPlugins
module Action module Action
class DestroyConfirm < Vagrant::Action::Builtin::Confirm class DestroyConfirm < Vagrant::Action::Builtin::Confirm
def initialize(app, env) def initialize(app, env)
force_key = :force_confirm_destroy
message = I18n.t("vagrant.commands.destroy.confirmation", message = I18n.t("vagrant.commands.destroy.confirmation",
:name => env[:machine].name) :name => env[:machine].name)
super(app, env, message) super(app, env, message, force_key)
end end
end end
end end

View File

@ -37,9 +37,11 @@ module VagrantPlugins
return if env["vagrant.error"].is_a?(Vagrant::Errors::VagrantError) return if env["vagrant.error"].is_a?(Vagrant::Errors::VagrantError)
# Interrupted, destroy the VM. We note that we don't want to # Interrupted, destroy the VM. We note that we don't want to
# validate the configuration here. # validate the configuration here, and we don't want to confirm
# we want to destroy.
destroy_env = env.clone destroy_env = env.clone
destroy_env[:validate] = false destroy_env[:validate] = false
destroy_env[:force_confirm_destroy] = true
env[:action_runner].run(Action.action_destroy, destroy_env) env[:action_runner].run(Action.action_destroy, destroy_env)
end end
end end