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

View File

@ -21,10 +21,10 @@
# [*step*] # [*step*]
# (Optional) The current step in deployment. See tripleo-heat-templates # (Optional) The current step in deployment. See tripleo-heat-templates
# for more details. # for more details.
# Defaults to hiera('step') # Defaults to Integer(lookup('step'))
# #
class tripleo::profile::base::swift::dispersion ( class tripleo::profile::base::swift::dispersion (
$step = Integer(hiera('step')), $step = Integer(lookup('step')),
) { ) {
if $step >= 5 { if $step >= 5 {
include swift::client include swift::client

View File

@ -20,7 +20,7 @@
# #
# [*bootstrap_node*] # [*bootstrap_node*]
# (Optional) The hostname of the node responsible for bootstrapping tasks # (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*] # [*ceilometer_enabled*]
# Whether the ceilometer pipeline is enabled. # Whether the ceilometer pipeline is enabled.
@ -28,27 +28,27 @@
# #
# [*oslomsg_rpc_proto*] # [*oslomsg_rpc_proto*]
# Protocol driver for the oslo messaging rpc service # 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*] # [*oslomsg_rpc_hosts*]
# list of the oslo messaging rpc host fqdns # 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*] # [*oslomsg_rpc_port*]
# IP port for oslo messaging rpc service # 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*] # [*oslomsg_rpc_username*]
# Username for oslo messaging rpc service # 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*] # [*oslomsg_rpc_password*]
# Password for oslo messaging rpc service # Password for oslo messaging rpc service
# Defaults to hiera('oslo_messaging_rpc_password') # Defaults to lookup('oslo_messaging_rpc_password')
# #
# [*oslomsg_rpc_use_ssl*] # [*oslomsg_rpc_use_ssl*]
# Enable ssl oslo messaging services # 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*] # [*certificates_specs*]
# (Optional) The specifications to give to certmonger for the certificate(s) # (Optional) The specifications to give to certmonger for the certificate(s)
@ -60,29 +60,29 @@
# service_certificate: <service certificate path> # service_certificate: <service certificate path>
# service_key: <service key path> # service_key: <service key path>
# principal: "haproxy/<overcloud controller fqdn>" # principal: "haproxy/<overcloud controller fqdn>"
# Defaults to hiera('apache_certificate_specs', {}). # Defaults to lookup('apache_certificates_specs', undef, undef, {}).
# #
# [*enable_internal_tls*] # [*enable_internal_tls*]
# (Optional) Whether TLS in the internal network is enabled or not. # (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*] # [*memcache_port*]
# (Optional) Memcached port to use. # (Optional) Memcached port to use.
# Defaults to hiera('memcached_port', 11211) # Defaults to lookup('memcached_port', undef, undef, 11211)
# #
# [*memcache_servers*] # [*memcache_servers*]
# (Optional) List of memcache servers # (Optional) List of memcache servers
# Defaults to hiera('memcached_node_names', []) # Defaults to lookup('memcached_node_names', undef, undef, [])
# #
# [*step*] # [*step*]
# (Optional) The current step in deployment. See tripleo-heat-templates # (Optional) The current step in deployment. See tripleo-heat-templates
# for more details. # for more details.
# Defaults to hiera('step') # Defaults to Integer(lookup('step'))
# #
# [*swift_proxy_network*] # [*swift_proxy_network*]
# (Optional) The network name where the swift proxy endpoint is listening on. # (Optional) The network name where the swift proxy endpoint is listening on.
# This is set by t-h-t. # 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*] # [*tls_proxy_bind_ip*]
# IP on which the TLS proxy will listen on. Required only if # IP on which the TLS proxy will listen on. Required only if
@ -104,20 +104,20 @@
# Defaults to false # Defaults to false
# #
class tripleo::profile::base::swift::proxy ( 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, $ceilometer_enabled = true,
$oslomsg_rpc_proto = hiera('oslo_messaging_rpc_scheme', 'rabbit'), $oslomsg_rpc_proto = lookup('oslo_messaging_rpc_scheme', undef, undef, 'rabbit'),
$oslomsg_rpc_hosts = any2array(hiera('oslo_messaging_rpc_node_names', undef)), $oslomsg_rpc_hosts = any2array(lookup('oslo_messaging_rpc_node_names', undef, undef, undef)),
$oslomsg_rpc_password = hiera('oslo_messaging_rpc_password'), $oslomsg_rpc_password = lookup('oslo_messaging_rpc_password'),
$oslomsg_rpc_port = hiera('oslo_messaging_rpc_port', '5672'), $oslomsg_rpc_port = lookup('oslo_messaging_rpc_port', undef, undef, '5672'),
$oslomsg_rpc_username = hiera('oslo_messaging_rpc_user_name', 'guest'), $oslomsg_rpc_username = lookup('oslo_messaging_rpc_user_name', undef, undef, 'guest'),
$oslomsg_rpc_use_ssl = hiera('oslo_messaging_rpc_use_ssl', '0'), $oslomsg_rpc_use_ssl = lookup('oslo_messaging_rpc_use_ssl', undef, undef, '0'),
$certificates_specs = hiera('apache_certificates_specs', {}), $certificates_specs = lookup('apache_certificates_specs', undef, undef, {}),
$enable_internal_tls = hiera('enable_internal_tls', false), $enable_internal_tls = lookup('enable_internal_tls', undef, undef, false),
$memcache_port = hiera('memcached_port', 11211), $memcache_port = lookup('memcached_port', undef, undef, 11211),
$memcache_servers = hiera('memcached_node_names', []), $memcache_servers = lookup('memcached_node_names', undef, undef, []),
$step = Integer(hiera('step')), $step = Integer(lookup('step')),
$swift_proxy_network = hiera('swift_proxy_network', undef), $swift_proxy_network = lookup('swift_proxy_network', undef, undef, undef),
$tls_proxy_bind_ip = undef, $tls_proxy_bind_ip = undef,
$tls_proxy_fqdn = undef, $tls_proxy_fqdn = undef,
$tls_proxy_port = 8080, $tls_proxy_port = 8080,

View File

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

View File

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