Sha256: fbe986ff5b6b977356e2f6e07bea295cc05dbecb31da9feb36acece2275b875e

Contents?: true

Size: 1.14 KB

Versions: 7

Compression:

Stored size: 1.14 KB

Contents

require 'log4r'

module VagrantPlugins
  module Kernel_V2
    # Represents a single configured provisioner for a VM.
    class VagrantConfigProvisioner
      # The name of the provisioner that should be registered
      # as a plugin.
      #
      # @return [Symbol]
      attr_reader :name

      # The configuration associated with the provisioner, if there is any.
      #
      # @return [Object]
      attr_reader :config

      def initialize(name, options=nil, &block)
        @logger = Log4r::Logger.new("vagrant::config::vm::provisioner")
        @logger.debug("Provisioner defined: #{name}")

        @config = nil
        @name   = name

        # Attempt to find the configuration class for this provider
        # if it exists and load the configuration.
        config_class = Vagrant.plugin("2").manager.provisioner_configs[@name]
        if !config_class
          @logger.info("Provisioner config for '#{@name}' not found. Ignoring config.")
          return
        end

        @config = config_class.new
        @config.set_options(options) if options
        block.call(@config) if block
        @config.finalize!
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
vagrantup-1.1.3 plugins/kernel_v2/config/vm_provisioner.rb
vagrantup-1.1.2 plugins/kernel_v2/config/vm_provisioner.rb
vagrantup-1.1.1 plugins/kernel_v2/config/vm_provisioner.rb
vagrantup-1.1.0 plugins/kernel_v2/config/vm_provisioner.rb
vagrantup-1.1.4 plugins/kernel_v2/config/vm_provisioner.rb
vagrant-actionio-0.0.9 vendor/bundle/bundler/gems/vagrant-c74251a1d9c0/plugins/kernel_v2/config/vm_provisioner.rb
vagrant-lxc-0.0.1 vendor/vagrant/plugins/kernel_v2/config/vm_provisioner.rb