`vagrant destroy` works in "guru meditation" state

This commit is contained in:
Mitchell Hashimoto 2012-04-12 10:18:34 -07:00
parent 00c4193b43
commit 4034a2db21
2 changed files with 8 additions and 2 deletions

View File

@ -4,6 +4,8 @@
- Human friendly error if connection times out for HTTP downloads. [GH-849] - Human friendly error if connection times out for HTTP downloads. [GH-849]
- Detect when the VirtualBox installation is incomplete and error. [GH-846] - Detect when the VirtualBox installation is incomplete and error. [GH-846]
- Use `LogLevel QUIET` for SSH to suppress the known hosts warning. [GH-847] - Use `LogLevel QUIET` for SSH to suppress the known hosts warning. [GH-847]
- VMs in the "guru meditation" state can be destroyed now using
`vagrant destroy`.
## 1.0.2 (March 25, 2012) ## 1.0.2 (March 25, 2012)

View File

@ -8,12 +8,16 @@ module Vagrant
end end
def call(env) def call(env)
if env[:vm].state == :running current_state = env[:vm].state
if !env["force"] if current_state == :running || current_state == :gurumeditation
# If the VM is running and we're not forcing, we can
# attempt a graceful shutdown
if current_state == :running && !env["force"]
env[:ui].info I18n.t("vagrant.actions.vm.halt.graceful") env[:ui].info I18n.t("vagrant.actions.vm.halt.graceful")
env[:vm].guest.halt env[:vm].guest.halt
end end
# If we're not powered off now, then force it
if env[:vm].state != :poweroff if env[:vm].state != :poweroff
env[:ui].info I18n.t("vagrant.actions.vm.halt.force") env[:ui].info I18n.t("vagrant.actions.vm.halt.force")
env[:vm].driver.halt env[:vm].driver.halt