23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/vagrant-down/plugin.rb', line 23
def execute
options = {
force: false
}
opts = OptionParser.new do |o|
o.banner = "Usage: vagrant down [vm-name]"
o.separator ""
o.on("-f", "--force", "Destroy without confirmation.") do |f|
options[:force] = f
end
end
argv = parse_options(opts)
return if !argv
@logger.debug("'Destroy' each target VM...")
declined = false
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) &&
action_env[:force_confirm_destroy_result] == false
end
declined ? 1 : 0
end
|