Skip to content

Commit ddb2fd7

Browse files
committed
Restructure if/else logic
Prior to this commit, the checks for managing the databases and having systemd were done in the same check, so the warning was confusing. This commit moves $manage_database_maintenance to its own if clause. It also moves the $manage_database_backups inside the version check if, because it makes more sense to put all of the resources behind the version check.
1 parent d5886c4 commit ddb2fd7

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

manifests/init.pp

+15-13
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,22 @@
3131
}
3232

3333
if $facts.dig('pe_databases', 'have_systemd') {
34-
if $manage_database_maintenance and (versioncmp('2019.0.2', $facts['pe_server_version']) <= 0) {
35-
class {'pe_databases::pg_repack':
36-
disable_maintenance => $disable_maintenance,
34+
if versioncmp('2019.0.2', $facts['pe_server_version']) <= 0 {
35+
if $manage_database_maintenance {
36+
class {'pe_databases::pg_repack':
37+
disable_maintenance => $disable_maintenance,
38+
}
39+
if $manage_table_settings {
40+
# This is to provide for situations, like PE XL,
41+
# where the pe-puppetdb database does not exist on the PostgreSQL system being tuned.
42+
# In PE XL, the Master and Replica run PostgreSQL for all databases *except* for pe-puppetdb.
43+
include pe_databases::postgresql_settings::table_settings
44+
}
3745
}
38-
if $manage_table_settings {
39-
# This is to provide for situations, like PE XL,
40-
# where the pe-puppetdb database does not exist on the PostgreSQL system being tuned.
41-
# In PE XL, the Master and Replica run PostgreSQL for all databases *except* for pe-puppetdb.
42-
include pe_databases::postgresql_settings::table_settings
46+
if defined('$manage_database_backups') {
47+
class { 'pe_databases::backup':
48+
disable_maintenance => ! $manage_database_backups,
49+
}
4350
}
4451
}
4552
else {
@@ -48,11 +55,6 @@
4855
loglevel => warning,
4956
}
5057
}
51-
if defined('$manage_database_backups') {
52-
class { 'pe_databases::backup':
53-
disable_maintenance => ! $manage_database_backups,
54-
}
55-
}
5658
}
5759
else {
5860
notify { 'pe_databases_systemd_warn':

0 commit comments

Comments
 (0)