Class: VagrantPlugins::ProviderLocal::Action::WaitTillBoot

Inherits:
Object
  • Object
show all
Includes:
Vagrant::Util::Retryable
Defined in:
lib/vagrant-local/action/wait_till_boot.rb

Overview

This is used wait till the instance is booted

Instance Method Summary collapse

Constructor Details

#initialize(app, _env) ⇒ WaitTillBoot

Returns a new instance of WaitTillBoot.



14
15
16
17
# File 'lib/vagrant-local/action/wait_till_boot.rb', line 14

def initialize(app, _env)
  @logger = Log4r::Logger.new('vagrant_local::action::import')
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



39
40
41
42
43
# File 'lib/vagrant-local/action/wait_till_boot.rb', line 39

def call(env)
  @machine = env[:machine]
  @driver  = @machine.provider.driver
  @app.call(env)
end

#terminate(env) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/vagrant-local/action/wait_till_boot.rb', line 19

def terminate(env)
  return unless env[:machine].state.id != :not_created

  # If we're not supposed to destroy on error then just return
  return unless env[:destroy_on_error]

  if env[:halt_on_error]
    halt_env = env.dup
    halt_env.delete(:interrupted)
    halt_env[:config_validate] = false
    env[:action_runner].run(Action.action_halt, halt_env)
  else
    destroy_env = env.dup
    destroy_env.delete(:interrupted)
    destroy_env[:config_validate] = false
    destroy_env[:force_confirm_destroy] = true
    env[:action_runner].run(Action.action_destroy, destroy_env)
  end
end