Class: VagrantPlugins::Skytap::Action::DeleteVm

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-skytap/action/delete_vm.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ DeleteVm

Deletes Skytap VM and removes it from the global machine index.


9
10
11
12
# File 'lib/vagrant-skytap/action/delete_vm.rb', line 9

def initialize(app, env)
  @app = app
  @logger = Log4r::Logger.new("vagrant_skytap::action::delete_vm")
end

Instance Method Details

#call(env) ⇒ Object


14
15
16
17
18
19
20
21
22
23
# File 'lib/vagrant-skytap/action/delete_vm.rb', line 14

def call(env)
  environment = env[:environment]
  if vm = environment.current_vm
    vm.delete
    environment.wait_until_ready
  end
  env[:machine].id = nil

  @app.call(env)
end