vagrant destroy exits with 1 if any confirmation are declined [GH-923]

This commit is contained in:
Mitchell Hashimoto 2013-07-10 19:39:20 -07:00
parent 56adfec96e
commit f38b6801f9
3 changed files with 14 additions and 3 deletions

View File

@ -6,6 +6,11 @@ FEATURES:
setting that accepts a path to a Ruby file to load as part of Chef
configuration, allowing you to override any setting available. [GH-876]
IMPROVEMENTS:
- `vagrant destroy` returns exit status 1 if any of the confirmations
are declined. [GH-923]
BUG FIXES:
- core/nfs: Exporting sub-directories of other exported folders now

View File

@ -29,6 +29,7 @@ module Vagrant
# The result is only true if the user said "Y"
env[:result] = choice && choice.upcase == "Y"
env["#{@force_key}_result".to_sym] = env[:result]
@app.call(env)
end

View File

@ -19,12 +19,17 @@ module VagrantPlugins
return if !argv
@logger.debug("'Destroy' each target VM...")
declined = false
with_target_vms(argv, :reverse => true) do |vm|
vm.action(:destroy, :force_confirm_destroy => options[:force])
action_env = vm.action(
:destroy, :force_confirm_destroy => options[:force])
declined = true if action_env.has_key?(:force_confirm_destroy_result) &&
action_env[:force_confirm_destroy_result] == false
end
# Success, exit status 0
0
# Success if no confirms were declined
declined ? 1 : 0
end
end
end