Ironic: 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: Ie280f3dcab6c887c3e5a6662c8d05c8fe98a8cf9
This commit is contained in:
Takashi Kajinami 2022-05-10 10:33:14 +09:00
parent 2b2c08a45d
commit 692174d276
4 changed files with 42 additions and 42 deletions

View File

@ -20,45 +20,45 @@
#
# [*bootstrap_node*]
# (Optional) The hostname of the node responsible for bootstrapping tasks
# Defaults to hiera('ironic_api_short_bootstrap_node_name')
# Defaults to lookup('ironic_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'))
#
# [*oslomsg_rpc_proto*]
# Protocol driver for the oslo messaging rpc service
# Defaults to hiera('oslo_messaging_rpc_scheme', rabbit)
# Defaults to lookup('oslo_messaging_rpc_scheme', undef, undef, 'rabbit')
#
# [*oslomsg_rpc_hosts*]
# list of the oslo messaging rpc host fqdns
# Defaults to hiera('oslo_messaging_rpc_node_names')
# Defaults to any2array(lookup('oslo_messaging_rpc_node_names', undef, undef, undef))
#
# [*oslomsg_rpc_port*]
# IP port for oslo messaging rpc service
# Defaults to hiera('oslo_messaging_rpc_port', 5672)
# Defaults to lookup('oslo_messaging_rpc_port', undef, undef, '5672')
#
# [*oslomsg_rpc_username*]
# Username for oslo messaging rpc service
# Defaults to hiera('oslo_messaging_rpc_user_name', 'guest')
# Defaults to lookup('oslo_messaging_rpc_user_name', undef, undef, 'guest')
#
# [*oslomsg_rpc_password*]
# Password for oslo messaging rpc service
# Defaults to hiera('oslo_messaging_rpc_password')
# Defaults to lookup('oslo_messaging_rpc_password')
#
# [*oslomsg_rpc_use_ssl*]
# Enable ssl oslo messaging services
# Defaults to hiera('oslo_messaging_rpc_use_ssl', '0')
# Defaults to lookup('oslo_messaging_rpc_use_ssl', undef, undef, '0')
class tripleo::profile::base::ironic (
$bootstrap_node = hiera('ironic_api_short_bootstrap_node_name', undef),
$step = Integer(hiera('step')),
$oslomsg_rpc_proto = hiera('oslo_messaging_rpc_scheme', 'rabbit'),
$oslomsg_rpc_hosts = any2array(hiera('oslo_messaging_rpc_node_names', undef)),
$oslomsg_rpc_password = hiera('oslo_messaging_rpc_password'),
$oslomsg_rpc_port = hiera('oslo_messaging_rpc_port', '5672'),
$oslomsg_rpc_username = hiera('oslo_messaging_rpc_user_name', 'guest'),
$oslomsg_rpc_use_ssl = hiera('oslo_messaging_rpc_use_ssl', '0'),
$bootstrap_node = lookup('ironic_api_short_bootstrap_node_name', undef, undef, undef),
$step = Integer(lookup('step')),
$oslomsg_rpc_proto = lookup('oslo_messaging_rpc_scheme', undef, undef, 'rabbit'),
$oslomsg_rpc_hosts = any2array(lookup('oslo_messaging_rpc_node_names', undef, undef, undef)),
$oslomsg_rpc_password = lookup('oslo_messaging_rpc_password'),
$oslomsg_rpc_port = lookup('oslo_messaging_rpc_port', undef, undef, '5672'),
$oslomsg_rpc_username = lookup('oslo_messaging_rpc_user_name', undef, undef, 'guest'),
$oslomsg_rpc_use_ssl = lookup('oslo_messaging_rpc_use_ssl', undef, undef, '0'),
) {
# Database is accessed by both API and conductor, hence it's here.
if $bootstrap_node and $::hostname == downcase($bootstrap_node) {

View File

@ -20,7 +20,7 @@
#
# [*bootstrap_node*]
# (Optional) The hostname of the node responsible for bootstrapping tasks
# Defaults to hiera('ironic_api_short_bootstrap_node_name')
# Defaults to lookup('ironic_api_short_bootstrap_node_name')
#
# [*certificates_specs*]
# (Optional) The specifications to give to certmonger for the certificate(s)
@ -32,27 +32,27 @@
# 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, {}).
#
# [*ironic_api_network*]
# (Optional) The network name where the ironic API endpoint is listening on.
# This is set by t-h-t.
# Defaults to hiera('ironic_api_network', undef)
# Defaults to lookup('ironic_api_network', undef, 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)
#
# [*step*]
# (Optional) The current step of the deployment
# Defaults to hiera('step')
# Defaults to Integer(lookup('step'))
#
class tripleo::profile::base::ironic::api (
$bootstrap_node = hiera('ironic_api_short_bootstrap_node_name', undef),
$certificates_specs = hiera('apache_certificates_specs', {}),
$ironic_api_network = hiera('ironic_api_network', undef),
$enable_internal_tls = hiera('enable_internal_tls', false),
$step = Integer(hiera('step')),
$bootstrap_node = lookup('ironic_api_short_bootstrap_node_name', undef, undef, undef),
$certificates_specs = lookup('apache_certificates_specs', undef, undef, {}),
$ironic_api_network = lookup('ironic_api_network', undef, undef, undef),
$enable_internal_tls = lookup('enable_internal_tls', undef, undef, false),
$step = Integer(lookup('step')),
) {
include tripleo::profile::base::ironic
include tripleo::profile::base::ironic::authtoken

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::ironic::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
) {

View File

@ -20,11 +20,11 @@
#
# [*bootstrap_node*]
# (Optional) The hostname of the node responsible for bootstrapping tasks
# Defaults to hiera('cinder_backup_short_bootstrap_node_name')
# Defaults to lookup('cinder_backup_short_bootstrap_node_name', undef, undef, undef)
#
# [*step*]
# (Optional) The current step of the deployment
# Defaults to hiera('step')
# Defaults to Integer(lookup('step'))
#
# [*manage_pxe*]
# (Optional) Whether to manage the PXE/iPXE environment for the conductor.
@ -35,8 +35,8 @@
# Defaults to false
#
class tripleo::profile::base::ironic::conductor (
$bootstrap_node = hiera('ironic_api_short_bootstrap_node_name', undef),
$step = Integer(hiera('step')),
$bootstrap_node = lookup('ironic_api_short_bootstrap_node_name', undef, undef, undef),
$step = Integer(lookup('step')),
$manage_pxe = true,
$enable_staging = false,
) {