Sha256: 2d85f7deb89c61247e41ecd712e220937c355973ea10530026e68e4bbc8c6dcb

Contents?: true

Size: 961 Bytes

Versions: 18

Compression:

Stored size: 961 Bytes

Contents

module Puppet::DataProviders

  def self.assert_loaded
    unless @loaded
      require 'puppet/pops'
      require 'puppet/data_providers/data_adapter'
    end
    @loaded = true
  end

  def self.lookup_in_environment(name, scope, merge)
    assert_loaded()
    adapter = Puppet::DataProviders::DataAdapter.adapt(Puppet.lookup(:current_environment))
    adapter.env_provider.lookup(name, scope, merge)
  end

  MODULE_NAME = 'module_name'.freeze

  def self.lookup_in_module(name, scope, merge)
    # Do not attempt to do a lookup in a module unless the name is qualified.
    qual_index = name.index('::')
    throw :no_such_key if qual_index.nil?
    module_name = name[0..qual_index-1]

    assert_loaded()
    adapter = Puppet::DataProviders::DataAdapter.adapt(Puppet.lookup(:current_environment))
    data_provider = adapter.module_provider(module_name)
    throw :no_such_key if data_provider.nil?
    data_provider.lookup(name, scope, merge)
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

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