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

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

Instance Method Summary collapse

Methods included from ActionHelpers

#current_vm

Constructor Details

#initialize(app, env) ⇒ DeleteVm

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



34
35
36
37
# File 'lib/vagrant-skytap/action/delete_vm.rb', line 34

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

Instance Method Details

#call(env) ⇒ Object



39
40
41
42
43
44
45
46
47
48
# File 'lib/vagrant-skytap/action/delete_vm.rb', line 39

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

  @app.call(env)
end