Class: Puppet::Plugins::DataProviders

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/plugins/data_providers.rb

Overview

Since:

  • Puppet 4.0.0

Defined Under Namespace

Classes: EnvironmentDataProvider, ModuleDataProvider

Constant Summary collapse

PER_MODULE_DATA_PROVIDER_KEY =

The lookup key for the multibind containing data provider name per module

Since:

  • Puppet 4.0.0

'puppet::module_data'
PER_MODULE_DATA_PROVIDER_TYPE =

The lookup type for the name of the per module data provider.

Since:

  • Puppet 4.0.0

String
ENV_DATA_PROVIDERS_KEY =

The lookup key for the multibind containing map of provider name to env data provider implementation.

Since:

  • Puppet 4.0.0

'puppet::environment_data_providers'
ENV_DATA_PROVIDERS_TYPE =

The lookup type for the multibind containing map of provider name to env data provider implementation.

Since:

  • Puppet 4.0.0

'Puppet::Plugins::DataProviders::EnvironmentDataProvider'
MODULE_DATA_PROVIDERS_KEY =

The lookup key for the multibind containing map of provider name to module data provider implementation.

Since:

  • Puppet 4.0.0

'puppet::module_data_providers'
MODULE_DATA_PROVIDERS_TYPE =

The lookup type for the multibind containing map of provider name to module data provider implementation.

Since:

  • Puppet 4.0.0

'Puppet::Plugins::DataProviders::ModuleDataProvider'

Class Method Summary collapse

Class Method Details

.hash_of_environment_data_providersObject

Since:

  • Puppet 4.0.0



44
45
46
47
# File 'lib/puppet/plugins/data_providers.rb', line 44

def self.hash_of_environment_data_providers
  @@HASH_OF_ENV_DATA_PROVIDERS ||= Puppet::Pops::Types::TypeFactory.hash_of(
    Puppet::Pops::Types::TypeFactory.type_of(ENV_DATA_PROVIDERS_TYPE))
end

.hash_of_module_data_providersObject

Since:

  • Puppet 4.0.0



39
40
41
42
# File 'lib/puppet/plugins/data_providers.rb', line 39

def self.hash_of_module_data_providers
  @@HASH_OF_MODULE_DATA_PROVIDERS ||= Puppet::Pops::Types::TypeFactory.hash_of(
    Puppet::Pops::Types::TypeFactory.type_of(MODULE_DATA_PROVIDERS_TYPE))
end

.hash_of_per_module_data_providerObject

Since:

  • Puppet 4.0.0



35
36
37
# File 'lib/puppet/plugins/data_providers.rb', line 35

def self.hash_of_per_module_data_provider
  @@HASH_OF_PER_MODULE_DATA_PROVIDERS ||= Puppet::Pops::Types::TypeFactory.hash_of(PER_MODULE_DATA_PROVIDER_TYPE)
end

.register_defaults(default_bindings) ⇒ Object

Registers a ‘none’ environment data provider, and a ‘none’ module data provider as the defaults. This is only done to allow that something binds to ‘none’ rather than removing the entire binding (which has the same effect).

Since:

  • Puppet 4.0.0



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/puppet/plugins/data_providers.rb', line 53

def self.register_defaults(default_bindings)
  default_bindings.bind do
    name('none')
    in_multibind(ENV_DATA_PROVIDERS_KEY)
    to_instance(ENV_DATA_PROVIDERS_TYPE)
  end

  default_bindings.bind do
    name('function')
    in_multibind(ENV_DATA_PROVIDERS_KEY)
    to_instance('Puppet::DataProviders::FunctionEnvDataProvider')
  end

  default_bindings.bind do
    name('none')
    in_multibind(MODULE_DATA_PROVIDERS_KEY)
    to_instance(MODULE_DATA_PROVIDERS_TYPE)
  end

  default_bindings.bind do
    name('function')
    in_multibind(MODULE_DATA_PROVIDERS_KEY)
    to_instance('Puppet::DataProviders::FunctionModuleDataProvider')
  end
end

.register_extensions(extensions) ⇒ Object

Since:

  • Puppet 4.0.0



29
30
31
32
33
# File 'lib/puppet/plugins/data_providers.rb', line 29

def self.register_extensions(extensions)
  extensions.multibind(PER_MODULE_DATA_PROVIDER_KEY).name(PER_MODULE_DATA_PROVIDER_KEY).hash_of(PER_MODULE_DATA_PROVIDER_TYPE)
  extensions.multibind(ENV_DATA_PROVIDERS_KEY).name(ENV_DATA_PROVIDERS_KEY).hash_of(ENV_DATA_PROVIDERS_TYPE)
  extensions.multibind(MODULE_DATA_PROVIDERS_KEY).name(MODULE_DATA_PROVIDERS_KEY).hash_of(MODULE_DATA_PROVIDERS_TYPE)
end