Sha256: bba25c9505c2e7bad8d94b29ad314b77a05165298e25705256a6d7e1fc8450b5

Contents?: true

Size: 1.1 KB

Versions: 40

Compression:

Stored size: 1.1 KB

Contents

module Vagrant
  class 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"].vm.start(@env.env.config.vm.boot_mode)
        end

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

          @env["config"].ssh.max_tries.to_i.times do |i|
            if @env["vm"].ssh.up?
              @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

40 entries across 40 versions & 5 rubygems

Version Path
vagrantup-0.8.9 lib/vagrant/action/vm/boot.rb
vagrantup-0.8.8 lib/vagrant/action/vm/boot.rb
vagrantup-0.8.7 lib/vagrant/action/vm/boot.rb
vagrantup-0.8.6 lib/vagrant/action/vm/boot.rb
vagrantup-0.8.5 lib/vagrant/action/vm/boot.rb
vagrantup-0.8.4 lib/vagrant/action/vm/boot.rb
vagrantup-0.8.3 lib/vagrant/action/vm/boot.rb
vagrantup-0.8.2 lib/vagrant/action/vm/boot.rb
vagrantup-0.8.10 lib/vagrant/action/vm/boot.rb
vagrantup-0.8.1 lib/vagrant/action/vm/boot.rb
vagrantup-0.8.0 lib/vagrant/action/vm/boot.rb
vagrantup-0.7.8 lib/vagrant/action/vm/boot.rb
vagrantup-0.7.7 lib/vagrant/action/vm/boot.rb
vagrantup-0.7.6 lib/vagrant/action/vm/boot.rb
vagrantup-0.7.5 lib/vagrant/action/vm/boot.rb
vagrantup-0.7.4 lib/vagrant/action/vm/boot.rb
vagrantup-0.7.3 lib/vagrant/action/vm/boot.rb
vagrantup-0.7.2 lib/vagrant/action/vm/boot.rb
vagrantup-0.7.1 lib/vagrant/action/vm/boot.rb
vagrantup-0.7.0 lib/vagrant/action/vm/boot.rb