Skip to content

Commit

Permalink
(SUP-4666) Implementation of conditional logic for enabling debug and…
Browse files Browse the repository at this point in the history
… echo
  • Loading branch information
Aaronoftheages committed Jan 29, 2024
1 parent 7d95c01 commit af7068b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion manifests/pg_repack.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@
# @param activity_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'activity' tables
# @param reports_tables_repack_timer [String] Deprecated Parameter will be removed in future releases
# @param resource_events_tables_repack_timer [String] Deprecated Parameter will be removed in future releases
# @param repack_run_level
# @param enable_echo
class pe_databases::pg_repack (
# Provided by module data
Array $fact_tables,
Array $catalog_tables,
Array $other_tables,
Array $activity_tables,
Boolean $disable_maintenance = false,
Enum['INFO','NOTICE','WARNING', 'ERROR', 'LOG', 'FATAL','PANIC','DEBUG'] $repack_run_level='DEBUG',
Boolean $enable_echo = true,
Integer $jobs = $facts['processors']['count'] / 4,
String[1] $facts_tables_repack_timer = $pe_databases::facts_tables_repack_timer,
String[1] $catalogs_tables_repack_timer = $pe_databases::catalogs_tables_repack_timer,
Expand All @@ -36,7 +40,14 @@
$postgresql_version = $facts['pe_postgresql_info']['installed_server_version']
$repack_executable = "/opt/puppetlabs/server/apps/postgresql/${postgresql_version}/bin/pg_repack"

$repack_cmd = "${repack_executable} --jobs ${jobs}"
#Add conditionals,
#If echo enabled = true run WITH
if $enable_echo {
$repack_cmd = "${repack_executable} --jobs ${jobs} --elevel ${repack_run_level} --echo"
} else {
$repack_cmd = "${repack_executable} --jobs ${jobs} --elevel ${repack_run_level}"
}
#else echo ommited - run without echo

pe_databases::collect { 'facts':
disable_maintenance => $disable_maintenance,
Expand Down

0 comments on commit af7068b

Please sign in to comment.