Class: HashiCorp::VagrantVMwareDesktop::Action::WaitForAddress

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/vagrant-vmware-desktop/action/wait_for_address.rb

Instance Method Summary collapse

Methods included from Common

#to_s

Constructor Details

#initialize(app, env) ⇒ WaitForAddress

Returns a new instance of WaitForAddress.



10
11
12
# File 'lib/vagrant-vmware-desktop/action/wait_for_address.rb', line 10

def initialize(app, env)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/vagrant-vmware-desktop/action/wait_for_address.rb', line 14

def call(env)
  env[:ui].info(
    I18n.t("hashicorp.vagrant_vmware_desktop.waiting_for_address"))
  while true
    # If we're interrupted then just back out
    return if env[:interrupted]

    # If we have an IP we are don
    break if env[:machine].provider.driver.read_ip(
      env[:machine].provider_config.enable_vmrun_ip_lookup
    )

    sleep 1
  end

  @app.call(env)
end