Class: VagrantPlugins::Abiquo::Actions::Reset

Inherits:
Object
  • Object
show all
Includes:
Vagrant::Util::Retryable, Helpers::Abiquo
Defined in:
lib/vagrant_abiquo/actions/reset.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) ⇒ Reset

Returns a new instance of Reset.



10
11
12
13
14
# File 'lib/vagrant_abiquo/actions/reset.rb', line 10

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

Instance Method Details

#call(env) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/vagrant_abiquo/actions/reset.rb', line 16

def call(env)
  env[:ui].info I18n.t('vagrant_abiquo.info.reloading')
  vm = get_vm(client, @machine.id)
  vm = reset(client, vm)

  # Give time to the OS to boot.
  retryable(:tries => 120, :sleep => 10) do
    next if env[:interrupted]
    raise 'not ready' if !@machine.communicate.ready?
  end

  @app.call(env)
end