Class: VagrantPlugins::Abiquo::Actions::PowerOff

Inherits:
Object
  • Object
show all
Includes:
Helpers::Abiquo
Defined in:
lib/vagrant_abiquo/actions/power_off.rb

Instance Method Summary collapse

Methods included from Helpers::Abiquo

#apply_state, #attach_net, #create_vapp, #create_vm, #deploy, #get_network, #get_template, #get_vapp, #get_vdc, #get_vm, #poweroff, #poweron, #reset, #update, #vapp_name

Constructor Details

#initialize(app, env) ⇒ PowerOff

Returns a new instance of PowerOff.



9
10
11
12
13
# File 'lib/vagrant_abiquo/actions/power_off.rb', line 9

def initialize(app, env)
  @app = app
  @machine = env[:machine]
  @logger = Log4r::Logger.new('vagrant::abiquo::power_off')
end

Instance Method Details

#call(env) ⇒ Object

Raises:

  • (PowerOffError)


15
16
17
18
19
20
21
# File 'lib/vagrant_abiquo/actions/power_off.rb', line 15

def call(env)
  vm = get_vm(client, @machine.id)
  vm = power_off(client, vm)
  raise PowerOffError, vm: vm.label, state: vm.state if vm.state != 'OFF'

  @app.call(env)
end