Sha256: cdd5026cce39ecea9f1a3276f3cda1201d18dda69dfe35ee5ad1897bea8124db

Contents?: true

Size: 1.54 KB

Versions: 54

Compression:

Stored size: 1.54 KB

Contents

require_relative 'hiera_config'

module Puppet::DataProviders::HieraSupport
  def config_path
    @hiera_config.nil? ? 'not yet configured' : @hiera_config.config_path
  end

  def name
    'Hiera Data Provider' + (@hiera_config.nil? ? '' : ", version #{@hiera_config.version}")
  end

  # Performs a lookup by searching all given paths for the given _key_. A merge will be performed if
  # the value is found in more than one location and _merge_ is not nil.
  #
  # @param key [String] The key to lookup
  # @param lookup_invocation [Puppet::Pops::Lookup::Invocation] The current lookup invocation
  # @param merge [Puppet::Pops::MergeStrategy,String,Hash<String,Object>,nil] Merge strategy or hash with strategy and options
  #
  # @api public
  def unchecked_lookup(key, lookup_invocation, merge)
    lookup_invocation.with(:data_provider, self) do
      merge_strategy = Puppet::Pops::MergeStrategy.strategy(merge)
      lookup_invocation.with(:merge, merge_strategy) do
        merged_result = merge_strategy.merge_lookup(data_providers(data_key(key, lookup_invocation), lookup_invocation)) do |data_provider|
          data_provider.unchecked_lookup(key, lookup_invocation, merge_strategy)
        end
        lookup_invocation.report_result(merged_result)
      end
    end
  end

  def data_providers(data_key, lookup_invocation)
    @hiera_config ||= Puppet::DataProviders::HieraConfig.new(provider_root(data_key, lookup_invocation.scope))
    @data_providers ||= @hiera_config.create_configured_data_providers(lookup_invocation, self)
  end
  private :data_providers
end

Version data entries

54 entries across 54 versions & 2 rubygems

Version Path
puppet-4.6.1-x86-mingw32 lib/puppet/data_providers/hiera_support.rb
puppet-4.6.1 lib/puppet/data_providers/hiera_support.rb
puppet-4.6.1-x64-mingw32 lib/puppet/data_providers/hiera_support.rb
puppet-4.6.1-universal-darwin lib/puppet/data_providers/hiera_support.rb
puppet-retrospec-1.1.0 vendor/gems/puppet-4.5.2/lib/puppet/data_providers/hiera_support.rb
puppet-4.5.3 lib/puppet/data_providers/hiera_support.rb
puppet-4.5.3-x86-mingw32 lib/puppet/data_providers/hiera_support.rb
puppet-4.5.3-x64-mingw32 lib/puppet/data_providers/hiera_support.rb
puppet-4.5.3-universal-darwin lib/puppet/data_providers/hiera_support.rb
puppet-retrospec-1.0.0 vendor/gems/puppet-4.5.2/lib/puppet/data_providers/hiera_support.rb
puppet-4.5.2 lib/puppet/data_providers/hiera_support.rb
puppet-4.5.2-x86-mingw32 lib/puppet/data_providers/hiera_support.rb
puppet-4.5.2-x64-mingw32 lib/puppet/data_providers/hiera_support.rb
puppet-4.5.2-universal-darwin lib/puppet/data_providers/hiera_support.rb
puppet-4.5.1 lib/puppet/data_providers/hiera_support.rb
puppet-4.5.1-x86-mingw32 lib/puppet/data_providers/hiera_support.rb
puppet-4.5.1-x64-mingw32 lib/puppet/data_providers/hiera_support.rb
puppet-4.5.1-universal-darwin lib/puppet/data_providers/hiera_support.rb
puppet-4.5.0 lib/puppet/data_providers/hiera_support.rb
puppet-4.5.0-x86-mingw32 lib/puppet/data_providers/hiera_support.rb