Skip to content

Commit dd1981f

Browse files
authored
Merge pull request #194 from puppetlabs/dont-override-defaults
Remove hardcoded mem settings from default pe.conf
2 parents 7008a3e + 065e8e1 commit dd1981f

File tree

1 file changed

+7
-31
lines changed

1 file changed

+7
-31
lines changed

functions/generate_pe_conf.pp

+7-31
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,20 @@
1-
# Generates a pe.conf file, removing undef parameters
1+
# @summary Generate a pe.conf file in JSON format
22
#
3-
# @param user_settings
3+
# @param settings
44
# A hash of settings to set in the config file. Any keys that are set to
5-
# undef will not be included in the config file. This is done to reduce the
6-
# amount of logic required within plans if parameters are not passed in.
5+
# undef will not be included in the config file.
76
#
87
function peadm::generate_pe_conf (
98
Hash $settings,
10-
) {
9+
) >> String {
1110
# Check that console_admin_password is present
1211
unless $settings['console_admin_password'] =~ String {
1312
fail('pe.conf must have the console_admin_password set')
1413
}
1514

16-
# Define the configuration settings that will be placed in pe.conf by
17-
# default. These can be overriden by user-supplied values in the $settings
18-
# hash.
19-
$defaults = {
20-
'puppet_enterprise::profile::master::java_args' => {
21-
'Xmx' => '2048m',
22-
'Xms' => '512m',
23-
},
24-
'puppet_enterprise::profile::console::java_args' => {
25-
'Xmx' => '768m',
26-
'Xms' => '256m',
27-
},
28-
'puppet_enterprise::profile::orchestrator::java_args' => {
29-
'Xmx' => '768m',
30-
'Xms' => '256m',
31-
},
32-
'puppet_enterprise::profile::puppetdb::java_args' => {
33-
'Xmx' => '768m',
34-
'Xms' => '256m',
35-
},
36-
}
37-
38-
# Merge the defaults with user-supplied settings, remove anything that is
39-
# undef, then output to JSON (and therefore HOCON, because HOCON is a
40-
# superset of JSON)
41-
($defaults + $settings).filter |$key,$value| {
15+
# Remove anything that is undef, then output to JSON (and therefore HOCON,
16+
# because HOCON is a superset of JSON)
17+
$settings.filter |$key,$value| {
4218
$value != undef
4319
}.to_json_pretty()
4420
}

0 commit comments

Comments
 (0)