commands/destroy: change exit codes [GH-811]
This commit is contained in:
parent
e78d087c27
commit
7da9ad0fa6
|
@ -24,6 +24,8 @@ FEATURES:
|
|||
|
||||
IMPROVEMENTS:
|
||||
|
||||
- commands/destroy: Exit codes changes. 0 means everything succeeded.
|
||||
1 means everything was declined. 2 means some were declined. [GH-811]
|
||||
- commands/ssh-config: Works without a target in multi-machine envs [GH-2844]
|
||||
- guests/freebsd: Support for virtio interfaces. [GH-3082]
|
||||
- guests/openbsd: Support for virtio interfaces. [GH-3082]
|
||||
|
|
|
@ -25,17 +25,25 @@ module VagrantPlugins
|
|||
return if !argv
|
||||
|
||||
@logger.debug("'Destroy' each target VM...")
|
||||
declined = false
|
||||
declined = 0
|
||||
total = 0
|
||||
with_target_vms(argv, :reverse => true) do |vm|
|
||||
action_env = vm.action(
|
||||
:destroy, :force_confirm_destroy => options[:force])
|
||||
|
||||
declined = true if action_env.has_key?(:force_confirm_destroy_result) &&
|
||||
total += 1
|
||||
declined += 1 if action_env.has_key?(:force_confirm_destroy_result) &&
|
||||
action_env[:force_confirm_destroy_result] == false
|
||||
end
|
||||
|
||||
# Success if no confirms were declined
|
||||
declined ? 1 : 0
|
||||
# Nothing was declined
|
||||
return 0 if declined == 0
|
||||
|
||||
# Everything was declined
|
||||
return 1 if declined == total
|
||||
|
||||
# Some was declined
|
||||
return 2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue