Etcd: 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: I436591ced7e8faa0c381c53722070de42d4bc117
This commit is contained in:
katarimanoj 2022-04-19 15:59:42 +05:30
parent a06b94c4a3
commit 97e698221e
1 changed files with 6 additions and 6 deletions

View File

@ -32,7 +32,7 @@
#
# [*nodes*]
# (Optional) Array of host(s) for etcd nodes.
# Defaults to hiera('etcd_node_ips', []).
# Defaults to lookup('etcd_node_ips', undef, undef, []).
#
# [*certificate_specs*]
# (Optional) The specifications to give to certmonger for the certificate
@ -48,21 +48,21 @@
#
# [*enable_internal_tls*]
# (Optional) Whether TLS in the internal network is enabled or not.
# Defaults to hiera('enable_internal_tls', false)
# Defaults to lookup('enable_internal_tls', undef, undef, false)
#
# [*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::etcd (
$bind_ip = '127.0.0.1',
$client_port = '2379',
$peer_port = '2380',
$nodes = hiera('etcd_node_names', []),
$nodes = lookup('etcd_node_names', undef, undef, []),
$certificate_specs = {},
$enable_internal_tls = hiera('enable_internal_tls', false),
$step = Integer(hiera('step')),
$enable_internal_tls = lookup('enable_internal_tls', undef, undef, false),
$step = Integer(lookup('step')),
) {
validate_legacy(Hash, 'validate_hash', $certificate_specs)