Method: Fog::Compute::VirtualBox::Server#destroy

Defined in:
lib/rackspace-fog/virtual_box/models/compute/server.rb

#destroyObject



81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/rackspace-fog/virtual_box/models/compute/server.rb', line 81

def destroy
  requires :name, :raw
  unless raw.state == :powered_off
    stop
    wait_for { raw.session_state == :closed }
  end
  raw.unregister(:full)
  config_file = connection.compose_machine_filename(name)
  config_directory = config_file.split(File::SEPARATOR)[0...-1].join(File::SEPARATOR)
  FileUtils.rm_rf(config_directory)
  true
end