puppet-tripleo/manifests/config.pp
Emilien Macchi e452c3d55c Introduce tripleo::config
tripleo::config is a class that will take care of param_config in THT.

Example in THT:

puppet_config:
  param_config:
    aodh_config:
      oslo_middleware:
        enable_proxy_headers_parsing: True

tripleo::config will call the aodh_config provider for each
parameter and its value, so here it'll call:

create_resources('aodh_config',
                 'oslo_middleware/enable_proxy_headers_parsing' => {
                   'value' => True
                 } )

Note: we add a filter capability where once can configure
tripleo::config with providers parameter to filter which providers we
want to call.

Change-Id: Ia008917475edcd086fb5076fab320206d05ea557
2019-06-04 18:07:21 +00:00

45 lines
1.1 KiB
Puppet

# == Class: tripleo::config
#
# Configure services with Puppet
#
# === Parameters:
#
# [*configs*]
# (optional) Configuration to inject.
# Should be an hash.
# Default to lookup('param_config', {})
#
# [*providers*]
# (optional) Filter the providers we want
# to use for config.
# Should be an array.
# Default to lookup('param_providers', Array[String], 'deep', [])
#
class tripleo::config(
$configs = lookup('param_config', {}),
$providers = lookup('param_providers', Array[String], 'deep', []),
) {
if ! empty($configs) {
# Allow composable services to load their own configurations.
# Each service can load its config options by using this form:
#
# puppet_config:
# param_config:
# 'aodh_config':
# DEFAULT:
# foo: fooValue
# bar: barValue
$configs.each |$provider, $sections| {
if empty($providers) or ($provider in $providers) {
$sections.each |$section, $params| {
$params.each |$param, $value| {
create_resources($provider, {"${section}/${param}" => {'value' => $value }})
}
}
}
}
}
}