Sha256: dd24bfff09e68237625e0b17037c1dc38e5b1ea878f33db5c7bb72a68b5352e7

Contents?: true

Size: 977 Bytes

Versions: 10

Compression:

Stored size: 977 Bytes

Contents

module Vagrant
  module Action
    module Builtin
      class CloudInitWait

        def initialize(app, env)
          @app    = app
          @logger = Log4r::Logger.new("vagrant::action::builtin::cloudinitwait")
        end

        def call(env)
          machine = env[:machine]
          cloud_init_wait_cmd = "cloud-init status --wait"
          if !machine.config.vm.cloud_init_configs.empty?
            if machine.communicate.test("command -v cloud-init")
              env[:ui].output(I18n.t("vagrant.cloud_init_waiting"))
              result = machine.communicate.sudo(cloud_init_wait_cmd, error_check: false)
              if result != 0
                raise Vagrant::Errors::CloudInitCommandFailed, cmd: cloud_init_wait_cmd, guest_name: machine.name
              end
            else
              raise Vagrant::Errors::CloudInitNotFound, guest_name: machine.name
            end
          end
          @app.call(env)
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
vagrant-unbundled-2.3.6.0 lib/vagrant/action/builtin/cloud_init_wait.rb
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/lib/vagrant/action/builtin/cloud_init_wait.rb
vagrant-unbundled-2.3.3.0 lib/vagrant/action/builtin/cloud_init_wait.rb
vagrant-unbundled-2.3.2.0 lib/vagrant/action/builtin/cloud_init_wait.rb
vagrant-unbundled-2.2.19.0 lib/vagrant/action/builtin/cloud_init_wait.rb
vagrant-unbundled-2.2.18.0 lib/vagrant/action/builtin/cloud_init_wait.rb
vagrant-unbundled-2.2.16.0 lib/vagrant/action/builtin/cloud_init_wait.rb
vagrant-unbundled-2.2.14.0 lib/vagrant/action/builtin/cloud_init_wait.rb
vagrant-aws-mkubenka-0.7.2.pre.24 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-22795b161bf6/lib/vagrant/action/builtin/cloud_init_wait.rb
vagrant-unbundled-2.2.10.0 lib/vagrant/action/builtin/cloud_init_wait.rb