fix: replace puppetdbquery with native PQL queries (#457)
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 Reviewed-on: #457
This commit was merged in pull request #457.
This commit is contained in:
@@ -20,9 +20,21 @@ class profiles::dns::master (
|
||||
$nameservers_array = $ns_role ? {
|
||||
undef => [$facts['networking']['fqdn']],
|
||||
default => $use_ns ? {
|
||||
'all' => sort(query_nodes("enc_role='${ns_role}'", 'networking.fqdn')),
|
||||
'region' => sort(query_nodes("enc_role='${ns_role}' and region=${facts['region']}", 'networking.fqdn')),
|
||||
'country' => sort(query_nodes("enc_role='${ns_role}' and country=${facts['country']}", 'networking.fqdn')),
|
||||
'all' => sort(puppetdb_query(
|
||||
"facts[certname] { name = 'enc_role' and value = '${ns_role}' }"
|
||||
).map |$fact| { $fact['certname'] }),
|
||||
'region' => sort(puppetdb_query(
|
||||
"facts[certname] {
|
||||
name = 'enc_role' and value = '${ns_role}' and
|
||||
certname in facts[certname] { name = 'region' and value = '${facts['region']}' }
|
||||
}"
|
||||
).map |$fact| { $fact['certname'] }),
|
||||
'country' => sort(puppetdb_query(
|
||||
"facts[certname] {
|
||||
name = 'enc_role' and value = '${ns_role}' and
|
||||
certname in facts[certname] { name = 'country' and value = '${facts['country']}' }
|
||||
}"
|
||||
).map |$fact| { $fact['certname'] }),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +44,9 @@ class profiles::dns::master (
|
||||
$facts['networking']['fqdn'] => $facts['networking']['ip']
|
||||
},
|
||||
default => $nameservers_array.reduce({}) |$acc, $fqdn| {
|
||||
$result = query_nodes("networking.fqdn='${fqdn}'", 'networking.ip')
|
||||
$result = puppetdb_query(
|
||||
"facts[certname,value] { name = 'networking' and certname = '${fqdn}' }"
|
||||
).map |$fact| { $fact['value']['ip'] }
|
||||
$ip = $result[0]
|
||||
$acc + { "${fqdn}." => $ip }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user