`destroy` asks for confirmation. [GH-699]

This commit is contained in:
Mitchell Hashimoto 2012-02-07 22:54:30 -08:00
parent fbcb2c6ddc
commit 6ed6c0c085
3 changed files with 18 additions and 2 deletions

View File

@ -8,6 +8,8 @@
a Vagrant environment is loaded. I don't anticipate this causing any
problems but it is a backwards incompatible change should a plugin
depend on this (but I don't see any reason why they would).
- `vagrant destroy` now asks for confirmation by default. This can be
overridden with the `--force` flag. [GH-699]
## 0.9.6 (February 7, 2012)

View File

@ -15,8 +15,17 @@ module Vagrant
@logger.debug("'Destroy' each target VM...")
with_target_vms(argv[0]) do |vm|
if vm.created?
@logger.info("Destroying: #{vm.name}")
vm.destroy
choice = @env.ui.ask(I18n.t("vagrant.commands.destroy.confirmation",
:name => vm.name))
if choice.upcase == "Y"
@logger.info("Destroying: #{vm.name}")
vm.destroy
else
@logger.info("Not destroying #{vm.name} since confirmation was declined.")
@env.ui.success(I18n.t("vagrant.commands.destroy.will_not_destroy",
:name => vm.name), :prefix => false)
end
else
@logger.info("Not destroying #{vm.name}, since it isn't created.")
vm.ui.info I18n.t("vagrant.commands.common.vm_not_created")

View File

@ -231,6 +231,11 @@ en:
vm_not_running: "VM is not currently running. Please bring it up to run this command."
box:
no_installed_boxes: "There are no installed boxes! Use `vagrant box add` to add some."
destroy:
confirmation: "Are you sure you want to destroy the '%{name}' VM? [Y/N] "
will_not_destroy: |-
The VM '%{name}' will not be destroyed, since the confirmation
was declined.
gem:
help_preamble: |-
`vagrant gem` is used to install Vagrant plugins via the RubyGems