Class: Engineyard::Local::Command::Terminate

Inherits:
Base show all
Defined in:
lib/engineyard-local/command/terminate.rb

Instance Attribute Summary

Attributes inherited from Base

#env, #options

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods inherited from Vagrant::Command::Base

#cookbook_status, #initialize

Methods included from Helpers

#insert_linebreaks, #merge_run_options, #run

Constructor Details

This class inherits a constructor from Engineyard::Local::Command::Base

Instance Method Details

#cached_data_pathObject



19
20
21
# File 'lib/engineyard-local/command/terminate.rb', line 19

def cached_data_path
  "#{@env.root_path}/.ey_local_data"
end

#exec(*args) ⇒ Object

Wrap Vagrant’s :destroy



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/engineyard-local/command/terminate.rb', line 7

def exec(*args)
  with_target_vms do |vm|
    if vm.created?
      env.ui.info( I18n.t( "eylocal.terminate.destroying" ) )
      vm.destroy
      File.unlink(cached_data_path) if FileTest.exist? cached_data_path
    else
      env.ui.info( I18n.t( "eylocal.terminate.not_created" ) )
    end
  end
end