Class: Vagrant::LXC::Action::WaitForCommunicator
- Inherits:
-
Object
- Object
- Vagrant::LXC::Action::WaitForCommunicator
- Defined in:
- lib/vagrant-lxc/action/wait_for_communicator.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ WaitForCommunicator
constructor
A new instance of WaitForCommunicator.
- #wait_for_communicator ⇒ Object
Constructor Details
#initialize(app, env) ⇒ WaitForCommunicator
Returns a new instance of WaitForCommunicator.
8 9 10 |
# File 'lib/vagrant-lxc/action/wait_for_communicator.rb', line 8 def initialize(app, env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/vagrant-lxc/action/wait_for_communicator.rb', line 12 def call(env) @env = env raise Vagrant::Errors::VMFailedToBoot if !wait_for_communicator @app.call env end |
#wait_for_communicator ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/vagrant-lxc/action/wait_for_communicator.rb', line 20 def wait_for_communicator max_tries = @env[:machine].config.ssh.max_tries.to_i max_tries.times do |i| if @env[:machine].communicate.ready? @env[:ui].info I18n.t("vagrant_lxc.messages.container_ready") return true end # Return true so that the vm_failed_to_boot error doesn't # get shown return true if @env[:interrupted] sleep 1 if !@env["vagrant.test"] end @env[:ui].error I18n.t("vagrant.actions.vm.boot.failed") false end |