Sha256: ceee70c395ae1d904db58ffa965a2700d0629d93035eeb18015ab63652e5e56d
Contents?: true
Size: 1001 Bytes
Versions: 6
Compression:
Stored size: 1001 Bytes
Contents
module VagrantPlugins module CommandDestroy class Command < Vagrant.plugin("2", :command) def execute options = {} options[:force] = false opts = OptionParser.new do |o| o.banner = "Usage: vagrant destroy [vm-name]" o.separator "" o.on("-f", "--force", "Destroy without confirmation.") do |f| options[:force] = f end end # Parse the options 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 # Success if no confirms were declined declined ? 1 : 0 end end end end
Version data entries
6 entries across 6 versions & 2 rubygems