Metrics/QDR: Replace hiera by lookup

The hiera function is deprecated and does not work with the latest
hieradata version 5. It should be replaced by the new lookup
function[1].

[1] https://puppet.com/docs/puppet/7/hiera_automatic.html

With the lookup function, we can define value type and merge behavior,
but these are kept default at this moment to limit scope of this change
to just simple replacement. Adding value type might be useful to make
sure the value is in expected type (especially when a boolean value is
expected), but we will revisit that later.

example:
lookup(<NAME>, [<VALUE TYPE>], [<MERGE BEHAVIOR>], [<DEFAULT VALUE>])

Change-Id: I11ff84f94db06dfd84ecd80ebb09c2a2076758eb
This commit is contained in:
Takashi Kajinami 2022-05-10 10:19:08 +09:00
parent 2b2c08a45d
commit 9be30d134b
4 changed files with 17 additions and 16 deletions

View File

@ -21,7 +21,7 @@
# [*step*]
# (Optional) The current step in deployment. See tripleo-heat-templates
# for more details.
# Defaults to hiera('step')
# Defaults to Integer(lookup('step'))
#
# [*enable_file_logging*]
# (Optional) Boolean. Whether to enable logfile plugin.
@ -63,6 +63,7 @@
# (Optional) List of strings. A list of active services in this tripleo
# deployment. This is used to look up service-specific plugins that
# need to be installed.
# Defaults to lookup('service_names', undef, undef, [])
#
# [*collectd_manage_repo*]
# (Optional) Boolean. Whether let collectd enable manage repositories.
@ -123,7 +124,7 @@
# [*qdr_mode*]
# (Optional) String. Mode in which the QDR service, to which collectd
# should be connected, is running.
# Defaults to hiera('tripleo::profile::base::metrics::qdr::router_mode', 'edge')
# Defaults to lookup('tripleo::profile::base::metrics::qdr::router_mode', undef, undef, 'edge')
#
# [*python_read_plugins*]
# (Optional) List of strings. List of third party python packages to install.
@ -139,7 +140,7 @@
# Defaults to false.
#
class tripleo::profile::base::metrics::collectd (
$step = Integer(hiera('step')),
$step = Integer(lookup('step')),
$enable_file_logging = false,
$collectd_server = undef,
$collectd_port = undef,
@ -159,8 +160,8 @@ class tripleo::profile::base::metrics::collectd (
$amqp_retry_delay = undef,
$amqp_interval = undef,
$amqp_send_queue_limit = undef,
$qdr_mode = hiera('tripleo::profile::base::metrics::qdr::router_mode', 'edge'),
$service_names = hiera('service_names', []),
$qdr_mode = lookup('tripleo::profile::base::metrics::qdr::router_mode', undef, undef, 'edge'),
$service_names = lookup('service_names', undef, undef, []),
$collectd_manage_repo = false,
$python_read_plugins = [],
$enable_sensubility = false,

View File

@ -2,7 +2,7 @@
# in the hiera data provided by THT.
define tripleo::profile::base::metrics::collectd::collectd_service (
) {
$plugins = hiera("'tripleo.collectd.plugins.${title}'", [])
$plugins = lookup("'tripleo.collectd.plugins.${title}'", undef, undef, [])
if $plugins {
::tripleo::profile::base::metrics::collectd::collectd_plugin {

View File

@ -73,12 +73,12 @@
#
# [*interior_mesh_nodes*]
# (optional) Comma separated list of controller nodes' fqdns
# Defaults to hiera('controller_node_names', '')
# Defaults to lookup('controller_node_names', undef, undef, '')
#
# [*interior_ip*]
# (optional) IP address which should be used for internal communication.
# Has to be member of interior_mesh_nodes
# Defaults to hiera('ctlplane', undef)
# Defaults to lookup('ctlplane', undef, undef, undef)
#
# [*connectors*]
# (optional) List of hashes containing configuration for outgoing connections
@ -108,7 +108,7 @@
# [*step*]
# (Optional) The current step in deployment. See tripleo-heat-templates
# for more details.
# Defaults to hiera('step')
# Defaults to Integer(lookup('step'))
#
# [*ssl_cert_dir*]
# (Optional) Path to directory where SSL certificate files should be created.
@ -128,15 +128,15 @@ class tripleo::profile::base::metrics::qdr (
$listener_ssl_pw_file = undef,
$listener_ssl_password = undef,
$listener_trusted_certs = undef,
$interior_mesh_nodes = hiera('controller_node_ips', ''),
$interior_ip = hiera('ctlplane', undef),
$interior_mesh_nodes = lookup('controller_node_ips', undef, undef, ''),
$interior_ip = lookup('ctlplane', undef, undef, undef),
$connectors = [],
$ssl_profiles = [],
$ssl_internal_profile_name = undef,
$addresses = [],
$autolink_addresses = [],
$router_mode = 'edge',
$step = Integer(hiera('step')),
$step = Integer(lookup('step')),
$ssl_cert_dir = '/etc/pki/tls/certs/',
) {
if $step >= 1 {

View File

@ -53,12 +53,12 @@
#
# [*oslomsg_rpc_hosts*]
# list of the oslo messaging rpc host fqdns
# Defaults to hiera('oslo_messaging_rpc_node_names', undef)
# Defaults to lookup('oslo_messaging_rpc_node_names', undef, undef, undef)
#
# [*step*]
# (Optional) The current step in deployment. See tripleo-heat-templates
# for more details.
# Defaults to hiera('step')
# Defaults to Integer(lookup('step'))
#
class tripleo::profile::base::qdr (
$qdr_username = undef,
@ -69,8 +69,8 @@ class tripleo::profile::base::qdr (
$listener_ssl_cert_file = undef,
$listener_ssl_key_file = undef,
$qdr_log_enable = 'info+',
$oslomsg_rpc_hosts = hiera('oslo_messaging_rpc_node_names', undef),
$step = Integer(hiera('step')),
$oslomsg_rpc_hosts = lookup('oslo_messaging_rpc_node_names', undef, undef, undef),
$step = Integer(lookup('step')),
) {
$qdr_node_names = $oslomsg_rpc_hosts