Class: Tenderloin::Actions::VM::Destroy

Inherits:
Base
  • Object
show all
Defined in:
lib/tenderloin/actions/vm/destroy.rb

Instance Attribute Summary

Attributes inherited from Base

#run_args, #runner

Instance Method Summary collapse

Methods inherited from Base

#cleanup, #initialize, #prepare, #rescue

Methods included from Util

#error_and_exit, included, #logger, #wrap_output

Constructor Details

This class inherits a constructor from Tenderloin::Actions::Base

Instance Method Details

#execute!Object



7
8
9
10
11
12
13
14
# File 'lib/tenderloin/actions/vm/destroy.rb', line 7

def execute!
  @runner.execute!(Halt) if @runner.running?
  @runner.invoke_around_callback(:destroy) do
    logger.info "Destroying VM and associated drives..."
    @runner.fusion_vm.delete
    FileUtils.rm_rf(File.dirname(@runner.vmx_path))
  end
end