From e1a721785c1645ee4d7d5855b5663bf4702581c0 Mon Sep 17 00:00:00 2001 From: Reid Vandewiele Date: Fri, 23 Jul 2021 15:58:35 -0700 Subject: [PATCH 1/2] Remove hardcoded mem settings from default pe.conf A long time ago these settings were added to faciliate local development on VirtualBox, using developer workstations. We should not provide different memory defaults for PE installs than what is provided by PE itself. Additional fix: found Puppet Strings bug which prevented generating a REFERENCE.md file. It is now possible to use Puppet Strings to generate a REFERENCE.md. --- functions/generate_pe_conf.pp | 44 ++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/functions/generate_pe_conf.pp b/functions/generate_pe_conf.pp index fcd4921c..1f15ae3e 100644 --- a/functions/generate_pe_conf.pp +++ b/functions/generate_pe_conf.pp @@ -1,13 +1,12 @@ -# Generates a pe.conf file, removing undef parameters +# @summary Generate a pe.conf file in JSON format # -# @param user_settings +# @param settings # A hash of settings to set in the config file. Any keys that are set to -# undef will not be included in the config file. This is done to reduce the -# amount of logic required within plans if parameters are not passed in. +# undef will not be included in the config file. # function peadm::generate_pe_conf ( Hash $settings, -) { +) >> String { # Check that console_admin_password is present unless $settings['console_admin_password'] =~ String { fail('pe.conf must have the console_admin_password set') @@ -16,23 +15,26 @@ function peadm::generate_pe_conf ( # Define the configuration settings that will be placed in pe.conf by # default. These can be overriden by user-supplied values in the $settings # hash. + # + # At this time, there are no defaults which need to be modified from the + # out-of-box defaults. $defaults = { - 'puppet_enterprise::profile::master::java_args' => { - 'Xmx' => '2048m', - 'Xms' => '512m', - }, - 'puppet_enterprise::profile::console::java_args' => { - 'Xmx' => '768m', - 'Xms' => '256m', - }, - 'puppet_enterprise::profile::orchestrator::java_args' => { - 'Xmx' => '768m', - 'Xms' => '256m', - }, - 'puppet_enterprise::profile::puppetdb::java_args' => { - 'Xmx' => '768m', - 'Xms' => '256m', - }, + # 'puppet_enterprise::profile::master::java_args' => { + # 'Xmx' => '2048m', + # 'Xms' => '512m', + # }, + # 'puppet_enterprise::profile::console::java_args' => { + # 'Xmx' => '768m', + # 'Xms' => '256m', + # }, + # 'puppet_enterprise::profile::orchestrator::java_args' => { + # 'Xmx' => '768m', + # 'Xms' => '256m', + # }, + # 'puppet_enterprise::profile::puppetdb::java_args' => { + # 'Xmx' => '768m', + # 'Xms' => '256m', + # }, } # Merge the defaults with user-supplied settings, remove anything that is From 065e8e11837ee0aa0212a8f8a9afcf25175b5d68 Mon Sep 17 00:00:00 2001 From: Reid Vandewiele Date: Mon, 26 Jul 2021 10:33:17 -0700 Subject: [PATCH 2/2] Remove defaults code in generate_pe_conf Removing for now as there is no need to set peadm-coded default pe.conf configuration values. To restore the ability to inject defaults into generated pe.conf files, revert this commit. --- functions/generate_pe_conf.pp | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/functions/generate_pe_conf.pp b/functions/generate_pe_conf.pp index 1f15ae3e..597e9d9f 100644 --- a/functions/generate_pe_conf.pp +++ b/functions/generate_pe_conf.pp @@ -12,35 +12,9 @@ function peadm::generate_pe_conf ( fail('pe.conf must have the console_admin_password set') } - # Define the configuration settings that will be placed in pe.conf by - # default. These can be overriden by user-supplied values in the $settings - # hash. - # - # At this time, there are no defaults which need to be modified from the - # out-of-box defaults. - $defaults = { - # 'puppet_enterprise::profile::master::java_args' => { - # 'Xmx' => '2048m', - # 'Xms' => '512m', - # }, - # 'puppet_enterprise::profile::console::java_args' => { - # 'Xmx' => '768m', - # 'Xms' => '256m', - # }, - # 'puppet_enterprise::profile::orchestrator::java_args' => { - # 'Xmx' => '768m', - # 'Xms' => '256m', - # }, - # 'puppet_enterprise::profile::puppetdb::java_args' => { - # 'Xmx' => '768m', - # 'Xms' => '256m', - # }, - } - - # Merge the defaults with user-supplied settings, remove anything that is - # undef, then output to JSON (and therefore HOCON, because HOCON is a - # superset of JSON) - ($defaults + $settings).filter |$key,$value| { + # Remove anything that is undef, then output to JSON (and therefore HOCON, + # because HOCON is a superset of JSON) + $settings.filter |$key,$value| { $value != undef }.to_json_pretty() }