Skip to content

Commit ed7d53b

Browse files
committed
Iterative fix improvement
To try and avoid dealing with the complexity of PuppetDB database host picking at the end of the manifest, see if having a sane class parameter default solves the problem cleanly. If it does, we can do a simple switch on replica/no-replica to create the B groups.
1 parent 7cf2520 commit ed7d53b

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

manifests/setup/node_manager.pp

+4-12
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
#
1414
class peadm::setup::node_manager (
1515
String[1] $master_host,
16-
String[1] $puppetdb_database_host,
16+
String[1] $puppetdb_database_host = $master_host,
17+
1718
String[1] $compiler_pool_address,
1819

1920
Optional[String[1]] $master_replica_host = undef,
20-
Optional[String[1]] $puppetdb_database_replica_host = undef,
21+
Optional[String[1]] $puppetdb_database_replica_host = $master_replica_host,
2122
) {
2223

2324
##################################################
@@ -129,9 +130,7 @@
129130
},
130131
variables => { 'peadm_replica' => true },
131132
}
132-
}
133133

134-
if $puppetdb_database_replica_host {
135134
node_group { 'PE Master B':
136135
ensure => present,
137136
parent => 'PE Infrastructure',
@@ -148,14 +147,7 @@
148147
},
149148
},
150149
}
151-
}
152150

153-
if ($puppetdb_database_replica_host) or ($master_replica_host) {
154-
if ($puppetdb_database_replica_host) {
155-
$dbhost = $puppetdb_database_replica_host
156-
} else {
157-
$dbhost = $puppetdb_database_host
158-
}
159151
node_group { 'PE Compiler Group B':
160152
ensure => 'present',
161153
parent => 'PE Master',
@@ -165,7 +157,7 @@
165157
],
166158
classes => {
167159
'puppet_enterprise::profile::puppetdb' => {
168-
'database_host' => $dbhost,
160+
'database_host' => $puppetdb_database_replica_host,
169161
},
170162
'puppet_enterprise::profile::master' => {
171163
'puppetdb_host' => ['${clientcert}', $master_host], # lint:ignore:single_quote_string_with_variables

plans/action/configure.pp

+1-4
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@
2525
$master_replica_target = peadm::get_targets($master_replica_host, 1)
2626
$puppetdb_database_replica_target = peadm::get_targets($puppetdb_database_replica_host, 1)
2727
$compiler_targets = peadm::get_targets($compiler_hosts)
28-
$puppetdb_database_target = $puppetdb_database_host ? {
29-
undef => $master_target,
30-
default => peadm::get_targets($puppetdb_database_host, 1)
31-
}
28+
$puppetdb_database_target = peadm::get_targets($puppetdb_database_host, 1)
3229

3330
# Ensure input valid for a supported architecture
3431
$arch = peadm::validate_architecture(

0 commit comments

Comments
 (0)