Class: HashiCorp::VagrantVMwareDesktop::Action::WaitForCommunicatorCompat

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

Instance Method Summary collapse

Methods included from Common

#to_s

Constructor Details

#initialize(app, env) ⇒ WaitForCommunicatorCompat

Returns a new instance of WaitForCommunicatorCompat.



10
11
12
# File 'lib/vagrant-vmware-desktop/action/wait_for_communicator_compat.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
31
# File 'lib/vagrant-vmware-desktop/action/wait_for_communicator_compat.rb', line 14

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

    if env[:machine].communicate.ready?
      env[:ui].info(I18n.t(
        "hashicorp.vagrant_vmware_desktop.booted_and_ready"))
      break
    end

    sleep 2
  end

  @app.call(env)
end