+ # get remaining cluster info and verify consistency
+ ###
+ $clusters = $facts['postgresql_clusters']
+ if $pg_port {
+ $filtered = $clusters.filter |$cluster| { $cluster['port'] == $pg_port }
+ if $filtered.length != 1 {
+ fail("Did not find exactly one cluster with port ${pg_port}")
+ }
+ $cluster = $filtered[0]
+ } elsif $pg_cluster and $pg_version {
+ $filtered = $clusters.filter |$cluster| { $cluster['version'] == $pg_version and $cluster['cluster'] == $pg_cluster}
+ if $filtered.length != 1 {
+ fail("Did not find exactly one cluster ${pg_version}/${pg_cluster}")
+ }
+ $cluster = $filtered[0]
+ } else {
+ fail('postgres::cluster::hba_entry needs either the port of both a pg version and cluster name')
+ }
+ $real_port = $cluster['port']
+ $real_version = $cluster['version']
+ $real_cluster = $cluster['cluster']
+ if $pg_version and $pg_version != $real_version {
+ fail("Inconsisten cluster version information: ${pg_version} != ${real_version}")
+ }
+ if $pg_cluster and $pg_cluster != $real_cluster {
+ fail("Inconsisten cluster name information: ${pg_cluster} != ${real_cluster}")
+ }
+ ###
+
+ if ($address and $firewall) {