Class: VagrantPlugins::Vultr::Action::Destroy

Inherits:
Object
  • Object
show all
Includes:
Helpers::Client
Defined in:
lib/vagrant-vultr/action/destroy.rb

Instance Method Summary collapse

Methods included from Helpers::Client

#client

Constructor Details

#initialize(app, env) ⇒ Destroy

Returns a new instance of Destroy.



9
10
11
12
13
14
# File 'lib/vagrant-vultr/action/destroy.rb', line 9

def initialize(app, env)
  @app = app
  @machine = env[:machine]
  @client = client
  @logger = Log4r::Logger.new('vagrant::vultr::destroy')
end

Instance Method Details

#call(env) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/vagrant-vultr/action/destroy.rb', line 16

def call(env)
  @client.destroy_server(@machine.id)

  env[:ui].info 'Waiting for server to be destroyed...'
  @client.wait_to_destroy(@machine.id)

  env[:ui].info 'Machine is destroyed.'
  @machine.id = nil

  @app.call(env)
end