Class: VagrantPlugins::TiktalikVagrant::Action::PowerOff

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-tiktalik/action/power_off.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ PowerOff

Returns a new instance of PowerOff.



9
10
11
12
13
# File 'lib/vagrant-tiktalik/action/power_off.rb', line 9

def initialize(app, env)
  @app    = app
  @logger = Log4r::Logger.new("vagrant_tiktalik::action::power_off")
  @config = env[:machine].provider_config
end

Instance Method Details

#call(env) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/vagrant-tiktalik/action/power_off.rb', line 15

def call(env)
  env[:ui].info(I18n.t("vagrant_tiktalik.powering_off"))

  t = Tiktalik
  t.api_key = @config.api_key
  t.api_secret_key = @config.api_secret
  t.ca_file = @config.ca_file

  i = Tiktalik::Computing::Instance
  instance = i.find env[:machine].id
  instance.stop

  @app.call(env)
end