fix: replace puppetdbquery with native PQL queries
Replace deprecated dalen-puppetdbquery module with native puppetdb_query function using PQL syntax to resolve URI.escape compatibility issues. This is required to migrated to Puppet 8 (and kubernetes). Changes: - Remove dalen-puppetdbquery dependency from Puppetfile - Replace query_nodes() calls with puppetdb_query() using PQL syntax - Update 27 function calls across 18 Puppet manifests - Maintain equivalent functionality with improved compatibility
This commit is contained in:
@@ -22,7 +22,9 @@ class incus::cluster (
|
||||
}
|
||||
|
||||
# if it is, find hosts, sort them so they dont cause changes every run
|
||||
$servers_array = sort(query_nodes("enc_role='${members_role}' and region='${facts['region']}'", 'networking.fqdn'))
|
||||
$servers_array = sort(puppetdb_query(
|
||||
"inventory[networking.fqdn] { facts.enc_role = '${members_role}' and facts.region = '${facts['region']}' }"
|
||||
).map |$node| { $node['networking.fqdn'] })
|
||||
|
||||
# else use provided array from params
|
||||
}else{
|
||||
|
||||
@@ -20,7 +20,9 @@ class redisha::redis (
|
||||
}
|
||||
|
||||
# if it is, find hosts, sort them so they dont cause changes every run
|
||||
$servers_array = sort(query_nodes("enc_role='${redisha_members_role}' and region='${facts['region']}'", 'networking.fqdn'))
|
||||
$servers_array = sort(puppetdb_query(
|
||||
"inventory[networking.fqdn] { facts.enc_role = '${redisha_members_role}' and facts.region = '${facts['region']}' }"
|
||||
).map |$node| { $node['networking.fqdn'] })
|
||||
|
||||
# else use provided array from params
|
||||
}else{
|
||||
|
||||
@@ -23,7 +23,9 @@ class redisha::sentinel (
|
||||
}
|
||||
|
||||
# if it is, find hosts, sort them so they dont cause changes every run
|
||||
$servers_array = sort(query_nodes("enc_role='${redisha_members_role}' and region='${facts['region']}'", 'networking.fqdn'))
|
||||
$servers_array = sort(puppetdb_query(
|
||||
"inventory[networking.fqdn] { facts.enc_role = '${redisha_members_role}' and facts.region = '${facts['region']}' }"
|
||||
).map |$node| { $node['networking.fqdn'] })
|
||||
|
||||
# else use provided array from params
|
||||
}else{
|
||||
|
||||
@@ -167,7 +167,13 @@ class stalwart (
|
||||
|
||||
# Query cluster members for validation
|
||||
$cluster_query = "enc_role='${cluster_role}' and country='${facts['country']}' and region='${facts['region']}'"
|
||||
$cluster_members_raw = query_nodes($cluster_query, 'networking.fqdn')
|
||||
$cluster_members_raw = puppetdb_query(
|
||||
"inventory[networking.fqdn] {
|
||||
facts.enc_role = '${cluster_role}' and
|
||||
facts.country = '${facts['country']}' and
|
||||
facts.region = '${facts['region']}'
|
||||
}"
|
||||
).map |$node| { $node['networking.fqdn'] }
|
||||
$cluster_members = $cluster_members_raw ? {
|
||||
undef => [],
|
||||
default => $cluster_members_raw,
|
||||
@@ -180,7 +186,13 @@ class stalwart (
|
||||
|
||||
# Query HAProxy nodes for proxy trusted networks
|
||||
$haproxy_query = "enc_role='${haproxy_role}' and country='${facts['country']}' and region='${facts['region']}'"
|
||||
$haproxy_members_raw = query_nodes($haproxy_query, 'networking.ip')
|
||||
$haproxy_members_raw = puppetdb_query(
|
||||
"inventory[networking.ip] {
|
||||
facts.enc_role = '${haproxy_role}' and
|
||||
facts.country = '${facts['country']}' and
|
||||
facts.region = '${facts['region']}'
|
||||
}"
|
||||
).map |$node| { $node['networking.ip'] }
|
||||
$haproxy_ips = $haproxy_members_raw ? {
|
||||
undef => [],
|
||||
default => sort($haproxy_members_raw),
|
||||
|
||||
Reference in New Issue
Block a user