Sha256: 8f36fe839541fb92dbcd22955e983356bf1b462f64b1817657e44a2aaaddca52

Contents?: true

Size: 1.12 KB

Versions: 21

Compression:

Stored size: 1.12 KB

Contents

module Vagrant
  module Action
    module VM
      class Boot
        def initialize(app, env)
          @app = app
          @env = env
        end

        def call(env)
          @env = env

          # Start up the VM and wait for it to boot.
          boot
          raise Errors::VMFailedToBoot if !wait_for_boot

          @app.call(env)
        end

        def boot
          @env[:ui].info I18n.t("vagrant.actions.vm.boot.booting")
          @env[:vm].driver.start(@env[:vm].config.vm.boot_mode)
        end

        def wait_for_boot
          @env[:ui].info I18n.t("vagrant.actions.vm.boot.waiting")

          @env[:vm].config.ssh.max_tries.to_i.times do |i|
            if @env[:vm].channel.ready?
              @env[:ui].info I18n.t("vagrant.actions.vm.boot.ready")
              return true
            end

            # Return true so that the vm_failed_to_boot error doesn't
            # get shown
            return true if @env[:interrupted]

            sleep 2 if !@env["vagrant.test"]
          end

          @env[:ui].error I18n.t("vagrant.actions.vm.boot.failed")
          false
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
vagrantup-1.0.1 lib/vagrant/action/vm/boot.rb
vagrantup-1.0.0 lib/vagrant/action/vm/boot.rb
vagrantup-0.9.99.2 lib/vagrant/action/vm/boot.rb
vagrantup-0.9.99.1 lib/vagrant/action/vm/boot.rb
vagrantup-0.9.7 lib/vagrant/action/vm/boot.rb
vagrantup-0.9.6 lib/vagrant/action/vm/boot.rb
vagrantup-0.9.5 lib/vagrant/action/vm/boot.rb
vagrantup-0.9.4 lib/vagrant/action/vm/boot.rb
vagrantup-0.9.3 lib/vagrant/action/vm/boot.rb
vagrantup-0.9.2 lib/vagrant/action/vm/boot.rb
vagrantup-0.9.1 lib/vagrant/action/vm/boot.rb
vagrantup-0.9.0 lib/vagrant/action/vm/boot.rb
vagrant-1.0.1 lib/vagrant/action/vm/boot.rb
vagrant-1.0.0 lib/vagrant/action/vm/boot.rb
vagrant-0.9.7 lib/vagrant/action/vm/boot.rb
vagrant-0.9.5 lib/vagrant/action/vm/boot.rb
vagrant-0.9.4 lib/vagrant/action/vm/boot.rb
vagrant-0.9.3 lib/vagrant/action/vm/boot.rb
vagrant-0.9.2 lib/vagrant/action/vm/boot.rb
vagrant-0.9.1 lib/vagrant/action/vm/boot.rb