Sha256: a16822dd1149312a1fd870d7f0be145bacbf37595b87c434ab2ee986ed759a42

Contents?: true

Size: 1 KB

Versions: 10

Compression:

Stored size: 1 KB

Contents

module Vagrant
  module Action
    module Builtin
      # This middleware is used with Call to test if this machine
      # has available provisioners
      class HasProvisioner
        def initialize(app, env)
          @app    = app
          @logger = Log4r::Logger.new("vagrant::action::builtin::has_provisioner")
        end

        def call(env)
          machine = env[:machine]

          if machine.provider.capability?(:has_communicator)
            has_communicator = machine.provider.capability(:has_communicator)
          else
            has_communicator = true
          end

          env[:skip] = []
          if !has_communicator
            machine.config.vm.provisioners.each do |p|
              if p.communicator_required
                env[:skip].push(p)
                @logger.info("Skipping running provisioner #{p.name || 'no name'}, type: #{p.type}")
                p.run = :never
              end
            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/has_provisioner.rb
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/lib/vagrant/action/builtin/has_provisioner.rb
vagrant-unbundled-2.3.3.0 lib/vagrant/action/builtin/has_provisioner.rb
vagrant-unbundled-2.3.2.0 lib/vagrant/action/builtin/has_provisioner.rb
vagrant-unbundled-2.2.19.0 lib/vagrant/action/builtin/has_provisioner.rb
vagrant-unbundled-2.2.18.0 lib/vagrant/action/builtin/has_provisioner.rb
vagrant-unbundled-2.2.16.0 lib/vagrant/action/builtin/has_provisioner.rb
vagrant-unbundled-2.2.14.0 lib/vagrant/action/builtin/has_provisioner.rb
vagrant-aws-mkubenka-0.7.2.pre.24 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-22795b161bf6/lib/vagrant/action/builtin/has_provisioner.rb
vagrant-unbundled-2.2.10.0 lib/vagrant/action/builtin/has_provisioner.rb