Sha256: a12c94b3090c769ad5b84578d005f32eff5b6eb72242bf163e6a13950a38a3e5

Contents?: true

Size: 1.12 KB

Versions: 18

Compression:

Stored size: 1.12 KB

Contents

# This file is loaded by the autoloader, and it does not find the data function support unless required relative
#
require_relative 'data_function_support'
module Puppet::DataProviders; end

# The FunctionEnvDataProvider provides data from a function called 'environment::data()' that resides in a
# directory environment (seen as a module with the name environment).
# The function is called on demand, and is associated with the compiler via an Adapter. This ensures that the data
# is only produced once per compilation.
#
class Puppet::DataProviders::FunctionEnvDataProvider < Puppet::Plugins::DataProviders::EnvironmentDataProvider
  include Puppet::DataProviders::DataFunctionSupport

  def lookup(name, scope, merge)
    begin
      hash = data('environment', scope)
      throw :no_such_key unless hash.include?(name)
      hash[name]
    rescue *Puppet::Error => detail
      raise Puppet::DataBinding::LookupError.new(detail.message, detail)
    end
  end

  def loader(key, scope)
    # This loader allows the data function to be private or public in the environment
    scope.compiler.loaders.private_environment_loader
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
puppet-4.2.3 lib/puppet/data_providers/function_env_data_provider.rb
puppet-4.2.3-x86-mingw32 lib/puppet/data_providers/function_env_data_provider.rb
puppet-4.2.3-x64-mingw32 lib/puppet/data_providers/function_env_data_provider.rb
puppet-4.2.2 lib/puppet/data_providers/function_env_data_provider.rb
puppet-4.2.2-x86-mingw32 lib/puppet/data_providers/function_env_data_provider.rb
puppet-4.2.2-x64-mingw32 lib/puppet/data_providers/function_env_data_provider.rb
puppet-4.2.1 lib/puppet/data_providers/function_env_data_provider.rb
puppet-4.2.1-x86-mingw32 lib/puppet/data_providers/function_env_data_provider.rb
puppet-4.2.1-x64-mingw32 lib/puppet/data_providers/function_env_data_provider.rb
puppet-4.2.0 lib/puppet/data_providers/function_env_data_provider.rb
puppet-4.2.0-x86-mingw32 lib/puppet/data_providers/function_env_data_provider.rb
puppet-4.2.0-x64-mingw32 lib/puppet/data_providers/function_env_data_provider.rb
puppet-4.1.0 lib/puppet/data_providers/function_env_data_provider.rb
puppet-4.1.0-x86-mingw32 lib/puppet/data_providers/function_env_data_provider.rb
puppet-4.1.0-x64-mingw32 lib/puppet/data_providers/function_env_data_provider.rb
puppet-4.0.0 lib/puppet/data_providers/function_env_data_provider.rb
puppet-4.0.0-x86-mingw32 lib/puppet/data_providers/function_env_data_provider.rb
puppet-4.0.0-x64-mingw32 lib/puppet/data_providers/function_env_data_provider.rb