Sha256: 1ba857140cdf520265133985124262283657b24d796aca889df04e0c8bace5a8

Contents?: true

Size: 1.82 KB

Versions: 68

Compression:

Stored size: 1.82 KB

Contents

require_relative 'hiera_config'

# TODO: API 5.0, remove this module
# @api private
# @deprecated
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
  def unchecked_lookup(key, lookup_invocation, merge)
    unless Puppet[:strict] == :off
      Puppet.warn_once(:deprecation, 'Puppet::DataProviders::HieraSupport',
      'Puppet::DataProviders::HieraSupport is deprecated and will be removed in the next major version of Puppet')
    end
    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

68 entries across 68 versions & 2 rubygems

Version Path
puppet-retrospec-1.8.0 vendor/pup410/lib/puppet/data_providers/hiera_support.rb
puppet-retrospec-1.7.0 vendor/pup410/lib/puppet/data_providers/hiera_support.rb
puppet-4.10.12 lib/puppet/data_providers/hiera_support.rb
puppet-4.10.12-x86-mingw32 lib/puppet/data_providers/hiera_support.rb
puppet-4.10.12-x64-mingw32 lib/puppet/data_providers/hiera_support.rb
puppet-4.10.12-universal-darwin lib/puppet/data_providers/hiera_support.rb
puppet-4.10.11 lib/puppet/data_providers/hiera_support.rb
puppet-4.10.11-x86-mingw32 lib/puppet/data_providers/hiera_support.rb
puppet-4.10.11-x64-mingw32 lib/puppet/data_providers/hiera_support.rb
puppet-4.10.11-universal-darwin lib/puppet/data_providers/hiera_support.rb
puppet-4.10.10 lib/puppet/data_providers/hiera_support.rb
puppet-4.10.10-x86-mingw32 lib/puppet/data_providers/hiera_support.rb
puppet-4.10.10-x64-mingw32 lib/puppet/data_providers/hiera_support.rb
puppet-4.10.10-universal-darwin lib/puppet/data_providers/hiera_support.rb
puppet-retrospec-1.6.1 vendor/pup410/lib/puppet/data_providers/hiera_support.rb
puppet-retrospec-1.6.0 vendor/pup410/lib/puppet/data_providers/hiera_support.rb
puppet-4.10.9 lib/puppet/data_providers/hiera_support.rb
puppet-4.10.9-x86-mingw32 lib/puppet/data_providers/hiera_support.rb
puppet-4.10.9-x64-mingw32 lib/puppet/data_providers/hiera_support.rb
puppet-4.10.9-universal-darwin lib/puppet/data_providers/hiera_support.rb