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: If206d72caf78cb3a524a1b8eb9ad4399ee4e3ce0
This commit is contained in:
Takashi Kajinami 2022-04-19 23:02:42 +09:00
parent 91eb91aad3
commit 8b88f000bc
9 changed files with 23 additions and 23 deletions

View File

@ -99,7 +99,7 @@
# (optional) When deep_compare is enabled and puppet updates a resource, this
# parameter represents the number (in seconds) to wait for the cluster to settle
# after the resource update.
# Defaults to hiera('pacemaker::resource::bundle::update_settle_secs', 600) (seconds)
# Defaults to lookup('pacemaker::resource::bundle::update_settle_secs', undef, undef, 600) (seconds)
#
# === Dependencies
#
@ -143,8 +143,8 @@ define pacemaker::resource::bundle(
$force = false,
$location_rule = undef,
$container_backend = 'docker',
$deep_compare = hiera('pacemaker::resource::bundle::deep_compare', false),
$update_settle_secs = hiera('pacemaker::resource::bundle::update_settle_secs', 600),
$deep_compare = lookup('pacemaker::resource::bundle::deep_compare', undef, undef, false),
$update_settle_secs = lookup('pacemaker::resource::bundle::update_settle_secs', undef, undef, 600),
) {
if $image == undef {
fail("Cannot create bundle ${name} without specifying an image")

View File

@ -93,7 +93,7 @@
# (optional) When deep_compare is enabled and puppet updates a resource, this
# parameter represents the number (in seconds) to wait for the cluster to settle
# after the resource update.
# Defaults to hiera('pacemaker::resource::filesystem::update_settle_secs', 600) (seconds)
# Defaults to lookup('pacemaker::resource::filesystem::update_settle_secs', undef, undef, 600) (seconds)
#
#
# === Dependencies
@ -139,7 +139,7 @@ define pacemaker::resource::filesystem(
$force = false,
$location_rule = undef,
$deep_compare = false,
$update_settle_secs = hiera('pacemaker::resource::filesystem::update_settle_secs', 600),
$update_settle_secs = lookup('pacemaker::resource::filesystem::update_settle_secs', undef, undef, 600),
) {
$resource_id = delete("fs-${directory}", '/')

View File

@ -82,13 +82,13 @@
# (optional) Enable deep comparing of resources and bundles
# When set to true a resource will be compared in full (options, meta parameters,..)
# to the existing one and in case of difference it will be repushed to the CIB
# Defaults to hiera('pacemaker::resource::ip::deep_compare', false)
# Defaults to lookup('pacemaker::resource::ip::deep_compare', undef, undef, false)
#
# [*update_settle_secs*]
# (optional) When deep_compare is enabled and puppet updates a resource, this
# parameter represents the number (in seconds) to wait for the cluster to settle
# after the resource update.
# Defaults to hiera('pacemaker::resource::ip::update_settle_secs', 600) (seconds)
# Defaults to lookup('pacemaker::resource::ip::update_settle_secs', undef, undef, 600) (seconds)
#
# === Dependencies
#
@ -131,8 +131,8 @@ define pacemaker::resource::ip(
$verify_on_create = false,
$force = false,
$location_rule = undef,
$deep_compare = hiera('pacemaker::resource::ip::deep_compare', false),
$update_settle_secs = hiera('pacemaker::resource::ip::update_settle_secs', 600),
$deep_compare = lookup('pacemaker::resource::ip::deep_compare', undef, undef, false),
$update_settle_secs = lookup('pacemaker::resource::ip::update_settle_secs', undef, undef, 600),
) {
if !($ip_address =~ Stdlib::Compat::Ipv6) and $ipv6_addrlabel != '' {
fail("ipv6_addrlabel ${ipv6_addrlabel} was specified, but ${ip_address} is not an ipv6 address")

View File

@ -84,7 +84,7 @@
# (optional) When deep_compare is enabled and puppet updates a resource, this
# parameter represents the number (in seconds) to wait for the cluster to settle
# after the resource update.
# Defaults to hiera('pacemaker::resource::lsb::update_settle_secs', 600) (seconds)
# Defaults to lookup('pacemaker::resource::lsb::update_settle_secs', undef, undef, 600) (seconds)
#
# === Dependencies
#
@ -127,7 +127,7 @@ define pacemaker::resource::lsb(
$force = false,
$location_rule = undef,
$deep_compare = false,
$update_settle_secs = hiera('pacemaker::resource::lsb::update_settle_secs', 600),
$update_settle_secs = lookup('pacemaker::resource::lsb::update_settle_secs', undef, undef, 600),
) {
pcmk_resource { $name:
ensure => $ensure,

View File

@ -88,7 +88,7 @@
# (optional) When deep_compare is enabled and puppet updates a resource, this
# parameter represents the number (in seconds) to wait for the cluster to settle
# after the resource update.
# Defaults to hiera('pacemaker::resource::ocf::update_settle_secs', 600) (seconds)
# Defaults to lookup('pacemaker::resource::ocf::update_settle_secs', undef, undef, 600) (seconds)
#
# === Dependencies
#
@ -131,8 +131,8 @@ define pacemaker::resource::ocf(
$verify_on_create = false,
$force = false,
$location_rule = undef,
$deep_compare = hiera('pacemaker::resource::ocf::deep_compare', false),
$update_settle_secs = hiera('pacemaker::resource::ocf::update_settle_secs', 600),
$deep_compare = lookup('pacemaker::resource::ocf::deep_compare', undef, undef, false),
$update_settle_secs = lookup('pacemaker::resource::ocf::update_settle_secs', undef, undef, 600),
) {
pcmk_resource { $name:
ensure => $ensure,

View File

@ -73,7 +73,7 @@
# (optional) When deep_compare is enabled and puppet updates a resource, this
# parameter represents the number (in seconds) to wait for the cluster to settle
# after the resource update.
# Defaults to hiera('pacemaker::resource::remote::update_settle_secs', 600) (seconds)
# Defaults to lookup('pacemaker::resource::remote::update_settle_secs', undef, undef, 600) (seconds)
#
# === Dependencies
#
@ -115,8 +115,8 @@ define pacemaker::resource::remote(
$pcs_user = 'hacluster',
$pcs_password = undef,
$location_rule = undef,
$deep_compare = hiera('pacemaker::resource::remote::deep_compare', false),
$update_settle_secs = hiera('pacemaker::resource::remote::update_settle_secs', 600),
$deep_compare = lookup('pacemaker::resource::remote::deep_compare', undef, undef, false),
$update_settle_secs = lookup('pacemaker::resource::remote::update_settle_secs', undef, undef, 600),
) {
# If we use pcs 0.10 we use the new pcs node remote-add way of adding
# remotes *except* if force_oldstyle is set to true

View File

@ -83,7 +83,7 @@
# (optional) When deep_compare is enabled and puppet updates a resource, this
# parameter represents the number (in seconds) to wait for the cluster to settle
# after the resource update.
# Defaults to hiera('pacemaker::resource::route::update_settle_secs', 600) (seconds)
# Defaults to lookup('pacemaker::resource::route::update_settle_secs', undef, undef, 600) (seconds)
#
# === Dependencies
#
@ -126,7 +126,7 @@ define pacemaker::resource::route(
$force = false,
$location_rule = undef,
$deep_compare = false,
$update_settle_secs = hiera('pacemaker::resource::route::update_settle_secs', 600),
$update_settle_secs = lookup('pacemaker::resource::route::update_settle_secs', undef, undef, 600),
) {
$nic_option = $nic ? {

View File

@ -84,7 +84,7 @@
# (optional) When deep_compare is enabled and puppet updates a resource, this
# parameter represents the number (in seconds) to wait for the cluster to settle
# after the resource update.
# Defaults to hiera('pacemaker::resource::service::update_settle_secs', 600) (seconds)
# Defaults to lookup('pacemaker::resource::service::update_settle_secs', undef, undef, 600) (seconds)
#
# === Dependencies
#
@ -127,7 +127,7 @@ define pacemaker::resource::service(
$force = false,
$location_rule = undef,
$deep_compare = false,
$update_settle_secs = hiera('pacemaker::resource::service::update_settle_secs', 600),
$update_settle_secs = lookup('pacemaker::resource::service::update_settle_secs', undef, undef, 600),
) {
include pacemaker::params
$res = "pacemaker::resource::${::pacemaker::params::services_manager}"

View File

@ -84,7 +84,7 @@
# (optional) When deep_compare is enabled and puppet updates a resource, this
# parameter represents the number (in seconds) to wait for the cluster to settle
# after the resource update.
# Defaults to hiera('pacemaker::resource::systemd::update_settle_secs', 600) (seconds)
# Defaults to lookup('pacemaker::resource::systemd::update_settle_secs', undef, undef, 600) (seconds)
#
# === Dependencies
#
@ -127,7 +127,7 @@ define pacemaker::resource::systemd(
$force = false,
$location_rule = undef,
$deep_compare = false,
$update_settle_secs = hiera('pacemaker::resource::systemd::update_settle_secs', 600),
$update_settle_secs = lookup('pacemaker::resource::systemd::update_settle_secs', undef, undef, 600),
) {
pcmk_resource { $name:
ensure => $ensure,