Class: VagrantPlugins::CommandDns::Command::Route53::Destroy

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-command-dns/command/route53/destroy.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/vagrant-command-dns/command/route53/destroy.rb', line 9

def execute
  options = {}
  options[:skip] = false

  opts = OptionParser.new do |o|
    o.banner = 'Usage: vagrant dns route53 destroy [options]'
    o.separator ''
    o.separator 'Options:'
    o.separator ''

    o.on('-s', '--skip', 'Skip ip check before record destruction. Use with extreme caution.') do |skip|
      options[:skip] = skip
    end

    o.separator ''
    o.separator 'Additional documentation can be found on the plugin homepage'
    o.separator ''
  end

  argv = parse_options(opts)
  return if !argv

  with_target_vms(argv) do |machine|
    machine.config.dns.__skip = options[:skip] if options[:skip]
    @env.action_runner.run(Action::Route53.route53_destroy, {
        machine: machine,
        ui: Vagrant::UI::Prefixed.new(@env.ui, 'dns route53'),
    })
  end

  0
end