Built-in DestroyConfirm middleware
This commit is contained in:
parent
105bf6129c
commit
780a312fc9
|
@ -1,5 +1,10 @@
|
||||||
## 1.2.2 (unreleased)
|
## 1.2.2 (unreleased)
|
||||||
|
|
||||||
|
FEATURES:
|
||||||
|
|
||||||
|
- New `DestroyConfirm` built-in middleware for providers so they can
|
||||||
|
more easily conform to the `destroy` action.
|
||||||
|
|
||||||
IMPROVEMENTS:
|
IMPROVEMENTS:
|
||||||
|
|
||||||
- No longer an error if the Chef run list is empty. It is now
|
- No longer an error if the Chef run list is empty. It is now
|
||||||
|
|
|
@ -12,6 +12,7 @@ module Vagrant
|
||||||
autoload :Call, "vagrant/action/builtin/call"
|
autoload :Call, "vagrant/action/builtin/call"
|
||||||
autoload :Confirm, "vagrant/action/builtin/confirm"
|
autoload :Confirm, "vagrant/action/builtin/confirm"
|
||||||
autoload :ConfigValidate, "vagrant/action/builtin/config_validate"
|
autoload :ConfigValidate, "vagrant/action/builtin/config_validate"
|
||||||
|
autoload :DestroyConfirm, "vagrant/action/builtin/destroy_confirm"
|
||||||
autoload :EnvSet, "vagrant/action/builtin/env_set"
|
autoload :EnvSet, "vagrant/action/builtin/env_set"
|
||||||
autoload :GracefulHalt, "vagrant/action/builtin/graceful_halt"
|
autoload :GracefulHalt, "vagrant/action/builtin/graceful_halt"
|
||||||
autoload :HandleBoxUrl, "vagrant/action/builtin/handle_box_url"
|
autoload :HandleBoxUrl, "vagrant/action/builtin/handle_box_url"
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
require_relative "confirm"
|
||||||
|
|
||||||
|
module Vagrant
|
||||||
|
module Action
|
||||||
|
module Builtin
|
||||||
|
# This class asks the user to confirm the destruction of a machine
|
||||||
|
# that Vagrant manages. This is provided as a built-in on top of
|
||||||
|
# {Confirm} because it sets up the proper keys and such so that
|
||||||
|
# `vagrant destroy -f` works properly.
|
||||||
|
class DestroyConfirm < Confirm
|
||||||
|
def initialize(app, env)
|
||||||
|
force_key = :force_confirm_destroy
|
||||||
|
message = I18n.t("vagrant.commands.destroy.confirmation",
|
||||||
|
:name => env[:machine].name)
|
||||||
|
|
||||||
|
super(app, env, message, force_key)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -16,7 +16,6 @@ module VagrantPlugins
|
||||||
autoload :Created, File.expand_path("../action/created", __FILE__)
|
autoload :Created, File.expand_path("../action/created", __FILE__)
|
||||||
autoload :Customize, File.expand_path("../action/customize", __FILE__)
|
autoload :Customize, File.expand_path("../action/customize", __FILE__)
|
||||||
autoload :Destroy, File.expand_path("../action/destroy", __FILE__)
|
autoload :Destroy, File.expand_path("../action/destroy", __FILE__)
|
||||||
autoload :DestroyConfirm, File.expand_path("../action/destroy_confirm", __FILE__)
|
|
||||||
autoload :DestroyUnusedNetworkInterfaces, File.expand_path("../action/destroy_unused_network_interfaces", __FILE__)
|
autoload :DestroyUnusedNetworkInterfaces, File.expand_path("../action/destroy_unused_network_interfaces", __FILE__)
|
||||||
autoload :DiscardState, File.expand_path("../action/discard_state", __FILE__)
|
autoload :DiscardState, File.expand_path("../action/discard_state", __FILE__)
|
||||||
autoload :Export, File.expand_path("../action/export", __FILE__)
|
autoload :Export, File.expand_path("../action/export", __FILE__)
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
require "vagrant/action/builtin/confirm"
|
|
||||||
|
|
||||||
module VagrantPlugins
|
|
||||||
module ProviderVirtualBox
|
|
||||||
module Action
|
|
||||||
class DestroyConfirm < Vagrant::Action::Builtin::Confirm
|
|
||||||
def initialize(app, env)
|
|
||||||
force_key = :force_confirm_destroy
|
|
||||||
message = I18n.t("vagrant.commands.destroy.confirmation",
|
|
||||||
:name => env[:machine].name)
|
|
||||||
|
|
||||||
super(app, env, message, force_key)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in New Issue