Swift: 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: I6ff74931b9ac95c7c2b134c249797e5b74c6471d
This commit is contained in:
katarimanoj 2022-04-19 21:39:56 +05:30
parent a06b94c4a3
commit 916e715036
5 changed files with 44 additions and 42 deletions

View File

@ -21,20 +21,20 @@
# [*step*]
# (Optional) The current step in deployment. See tripleo-heat-templates
# for more details.
# Defaults to hiera('step')
# Defaults to Integer(lookup('step'))
#
# [*memcache_port*]
# (Optional) Memcached port to use.
# Defaults to hiera('memcached_port', 11211)
# Defaults to lookup('memcached_port', undef, undef, 11211)
#
# [*memcache_servers*]
# (Optional) List of memcache servers
# Defaults to hiera('memcached_node_names', [])
# Defaults to lookup('memcached_node_names', undef, undef, [])
#
class tripleo::profile::base::swift (
$step = Integer(hiera('step')),
$memcache_port = hiera('memcached_port', 11211),
$memcache_servers = hiera('memcached_node_names', []),
$step = Integer(lookup('step')),
$memcache_port = lookup('memcached_port', undef, undef, 11211),
$memcache_servers = lookup('memcached_node_names', undef, undef, []),
) {
if $step >= 4 {
$swift_memcache_servers = suffix(any2array(normalize_ip_for_uri($memcache_servers)), ":${memcache_port}")

View File

@ -21,10 +21,10 @@
# [*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::swift::dispersion (
$step = Integer(hiera('step')),
$step = Integer(lookup('step')),
) {
if $step >= 5 {
include swift::client

View File

@ -20,7 +20,7 @@
#
# [*bootstrap_node*]
# (Optional) The hostname of the node responsible for bootstrapping tasks
# Defaults to hiera('swift_proxy_short_bootstrap_node_name')
# Defaults to lookup('swift_proxy_short_bootstrap_node_name', undef, undef, undef)
#
# [*ceilometer_enabled*]
# Whether the ceilometer pipeline is enabled.
@ -28,27 +28,27 @@
#
# [*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')
#
# [*certificates_specs*]
# (Optional) The specifications to give to certmonger for the certificate(s)
@ -60,29 +60,29 @@
# 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)
#
# [*memcache_port*]
# (Optional) Memcached port to use.
# Defaults to hiera('memcached_port', 11211)
# Defaults to lookup('memcached_port', undef, undef, 11211)
#
# [*memcache_servers*]
# (Optional) List of memcache servers
# Defaults to hiera('memcached_node_names', [])
# Defaults to lookup('memcached_node_names', 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'))
#
# [*swift_proxy_network*]
# (Optional) The network name where the swift proxy endpoint is listening on.
# This is set by t-h-t.
# Defaults to hiera('swift_proxy_network', undef)
# Defaults to lookup('swift_proxy_network', undef, undef, undef)
#
# [*tls_proxy_bind_ip*]
# IP on which the TLS proxy will listen on. Required only if
@ -104,20 +104,20 @@
# Defaults to false
#
class tripleo::profile::base::swift::proxy (
$bootstrap_node = hiera('swift_proxy_short_bootstrap_node_name', undef),
$bootstrap_node = lookup('swift_proxy_short_bootstrap_node_name', undef, undef, undef),
$ceilometer_enabled = true,
$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'),
$certificates_specs = hiera('apache_certificates_specs', {}),
$enable_internal_tls = hiera('enable_internal_tls', false),
$memcache_port = hiera('memcached_port', 11211),
$memcache_servers = hiera('memcached_node_names', []),
$step = Integer(hiera('step')),
$swift_proxy_network = hiera('swift_proxy_network', undef),
$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'),
$certificates_specs = lookup('apache_certificates_specs', undef, undef, {}),
$enable_internal_tls = lookup('enable_internal_tls', undef, undef, false),
$memcache_port = lookup('memcached_port', undef, undef, 11211),
$memcache_servers = lookup('memcached_node_names', undef, undef, []),
$step = Integer(lookup('step')),
$swift_proxy_network = lookup('swift_proxy_network', undef, undef, undef),
$tls_proxy_bind_ip = undef,
$tls_proxy_fqdn = undef,
$tls_proxy_port = 8080,

View File

@ -33,7 +33,7 @@
# [*step*]
# (Optional) The current step in deployment. See tripleo-heat-templates
# for more details.
# Defaults to hiera('step')
# Defaults to Integer(lookup('step'))
#
# [*swift_zones*]
# (Optional) The swift zones
@ -52,7 +52,7 @@
#
# [*swift_storage_node_ips*]
# (Optional) list of ip addresses for nodes running swift_storage service
# Defaults to hiera('swift_storage_node_ips') or an empty list
# Defaults to lookup('swift_storage_node_ips', undef, undef, [])
#
# [*part_power*]
# (Optional) The total number of partitions that should exist in the ring.
@ -65,9 +65,11 @@
#
# [*swift_ring_get_tempurl*]
# GET tempurl to fetch Swift rings from
# Defaults to lookup('swift_ring_get_tempurl', undef, undef, '')
#
# [*swift_ring_put_tempurl*]
# PUT tempurl to upload Swift rings to
# Defaults to lookup('swift_ring_put_tempurl', undef, undef, '')
#
# [*skip_consistency_check*]
# If set to true, skip the recon check to ensure rings are identical on all
@ -77,15 +79,15 @@ class tripleo::profile::base::swift::ringbuilder (
$replicas,
$build_ring = true,
$devices = undef,
$step = Integer(hiera('step')),
$step = Integer(lookup('step')),
$swift_zones = '1',
$raw_disk_prefix = 'r1z1-',
$raw_disks = [],
$swift_storage_node_ips = hiera('swift_storage_node_ips', []),
$swift_storage_node_ips = lookup('swift_storage_node_ips', undef, undef, []),
$part_power = undef,
$min_part_hours = undef,
$swift_ring_get_tempurl = hiera('swift_ring_get_tempurl', ''),
$swift_ring_put_tempurl = hiera('swift_ring_put_tempurl', ''),
$swift_ring_get_tempurl = lookup('swift_ring_get_tempurl', undef, undef, ''),
$swift_ring_put_tempurl = lookup('swift_ring_put_tempurl', undef, undef, ''),
$skip_consistency_check = false,
) {

View File

@ -25,7 +25,7 @@
# [*step*]
# (Optional) The current step in deployment. See tripleo-heat-templates
# for more details.
# Defaults to hiera('step')
# Defaults to Integer(lookup('step'))
#
# [*use_local_dir*]
# (Optional) Creates a local directory to store data on the system disk
@ -38,7 +38,7 @@
class tripleo::profile::base::swift::storage (
# Deprecated conditional to support ControllerEnableSwiftStorage parameter
$enable_swift_storage = true,
$step = Integer(hiera('step')),
$step = Integer(lookup('step')),
$use_local_dir = true,
$local_dir = '/srv/node/d1',
) {