Placement: 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: I22a8e6e4699e5ec8182307a3053eac666b57f8f9
This commit is contained in:
Takashi Kajinami 2022-05-02 17:35:19 +09:00
parent 2b2c08a45d
commit 29ce3e35e0
3 changed files with 26 additions and 26 deletions

View File

@ -20,15 +20,15 @@
#
# [*bootstrap_node*]
# (Optional) The hostname of the node responsible for bootstrapping tasks
# Defaults to hiera('nova_api_short_bootstrap_node_name')
# Defaults to lookup('nova_api_short_bootstrap_node_name', undef, undef, undef)
#
# [*step*]
# (Optional) The current step of the deployment
# Defaults to hiera('step')
# Defaults to Integer(lookup('step'))
class tripleo::profile::base::placement (
$bootstrap_node = hiera('placement_api_short_bootstrap_node_name', undef),
$step = Integer(hiera('step')),
$bootstrap_node = lookup('placement_api_short_bootstrap_node_name', undef, undef, undef),
$step = Integer(lookup('step')),
) {
if $bootstrap_node and $::hostname == downcase($bootstrap_node) {

View File

@ -18,7 +18,7 @@
#
# [*bootstrap_node*]
# (Optional) The hostname of the node responsible for bootstrapping tasks
# Defaults to hiera('placement_short_bootstrap_node_name')
# Defaults to lookup('placement_short_bootstrap_node_name', undef, undef, undef)
#
# [*certificates_specs*]
# (Optional) The specifications to give to certmonger for the certificate(s)
@ -30,28 +30,28 @@
# service_certificate: <service certificate path>
# service_key: <service key path>
# principal: "haproxy/<overcloud controller fqdn>"
# Defaults to hiera('apache_certificate_specs', {}).
# Defaults to lookup('apache_certificates_specs', undef, undef, {}).
#
# [*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)
#
# [*placement_network*]
# (Optional) The network name where the nova placement endpoint is listening on.
# This is set by t-h-t.
# Defaults to hiera('placement_network', undef)
# Defaults to lookup('placement_network', 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::placement::api (
$bootstrap_node = hiera('placement_short_bootstrap_node_name', undef),
$certificates_specs = hiera('apache_certificates_specs', {}),
$enable_internal_tls = hiera('enable_internal_tls', false),
$placement_network = hiera('placement_network', undef),
$step = Integer(hiera('step')),
$bootstrap_node = lookup('placement_short_bootstrap_node_name', undef, undef, undef),
$certificates_specs = lookup('apache_certificates_specs', undef, undef, {}),
$enable_internal_tls = lookup('enable_internal_tls', undef, undef, false),
$placement_network = lookup('placement_network', undef, undef, undef),
$step = Integer(lookup('step')),
) {
if $bootstrap_node and $::hostname == downcase($bootstrap_node) {
$is_bootstrap = true

View File

@ -21,28 +21,28 @@
# [*step*]
# (Optional) The current step in deployment. See tripleo-heat-templates
# for more details.
# Defaults to hiera('step')
# Defaults to Integer(lookup('step'))
#
# [*memcached_hosts*]
# (Optional) Array of hostnames, ipv4 or ipv6 addresses for memcache.
# Defaults to hiera('memcached_node_names', [])
# Defaults to lookup('memcached_node_names', undef, undef, [])
#
# [*memcached_port*]
# (Optional) Memcached port to use.
# Defaults to hiera('memcached_authtoken_port', 11211)
# Defaults to lookup('memcached_authtoken_port', undef, undef, 11211)
#
# [*memcached_ipv6*]
# (Optional) Whether Memcached uses IPv6 network instead of IPv4 network.
# Defauls to hiera('memcached_ipv6', false)
# Defauls to lookup('memcached_ipv6', undef, undef, false)
#
# [*security_strategy*]
# (Optional) Memcached (authtoken) security strategy.
# Defaults to hiera('memcached_authtoken_security_strategy', undef)
# Defaults to lookup('memcached_authtoken_security_strategy', undef, undef, undef)
#
# [*secret_key*]
# (Optional) Memcached (authtoken) secret key, used with security_strategy.
# The key is hashed with a salt, to isolate services.
# Defaults to hiera('memcached_authtoken_secret_key', undef)
# Defaults to lookup('memcached_authtoken_secret_key', undef, undef, undef)
#
# DEPRECATED PARAMETERS
#
@ -51,12 +51,12 @@
# Defaults to undef
#
class tripleo::profile::base::placement::authtoken (
$step = Integer(hiera('step')),
$memcached_hosts = hiera('memcached_node_names', []),
$memcached_port = hiera('memcached_authtoken_port', 11211),
$memcached_ipv6 = hiera('memcached_ipv6', false),
$security_strategy = hiera('memcached_authtoken_security_strategy', undef),
$secret_key = hiera('memcached_authtoken_secret_key', undef),
$step = Integer(lookup('step')),
$memcached_hosts = lookup('memcached_node_names', undef, undef, []),
$memcached_port = lookup('memcached_authtoken_port', undef, undef, 11211),
$memcached_ipv6 = lookup('memcached_ipv6', undef, undef, false),
$security_strategy = lookup('memcached_authtoken_security_strategy', undef, undef, undef),
$secret_key = lookup('memcached_authtoken_secret_key', undef, undef, undef),
# DEPRECATED PARAMETERS
$memcached_ips = undef
) {