Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1 from raphink/dev/java_arg
Browse files Browse the repository at this point in the history
Manage JAVA_ARGS parameters individually
  • Loading branch information
mcanevet committed Oct 27, 2014
2 parents 714ac2a + e5f01a6 commit 4849482
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 9 deletions.
23 changes: 14 additions & 9 deletions manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
class puppetserver::config {
$target = $::osfamily ? {
Debian => '/etc/default/puppetserver',
RedHat => '/etc/sysconfig/puppetserver',
}
::puppetserver::config::java_arg {
'-Xms':
ensure => 'present',
value => $::puppetserver::java_xms,
;

'-Xmx':
ensure => 'present',
value => $::puppetserver::java_xmx,
;

shellvar { 'JAVA_ARGS':
ensure => present,
target => $target,
variable => 'JAVA_ARGS',
value => "-Xms${::puppetserver::java_xms} -Xmx${::puppetserver::java_xmx} -XX:MaxPermSize=256m"
'-XX:MaxPermSize=':
ensure => 'present',
value => '256m',
;
}
}
35 changes: 35 additions & 0 deletions manifests/config/java_arg.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
define puppetserver::config::java_arg (
$value,
$ensure = 'present',
) {
case $ensure {
'present': {
$changes = [
'set JAVA_ARGS/quote "\""',
"set JAVA_ARGS/value[.=~regexp('${name}.*')] '${name}${value}'",
]
}

'absent': {
$changes = [
"rm JAVA_ARGS/value[.=~regexp('${name}.*')]",
'rm JAVA_ARGS[count(value)=0]',
]
}

default: {
fail 'Wrong value for "ensure".'
}
}

$target = $::osfamily ? {
Debian => '/etc/default/puppetserver',
RedHat => '/etc/sysconfig/puppetserver',
}

augeas { "Set puppetserver java_arg ${title}":
lens => 'Shellvars_list.lns',
incl => $target,
changes => $changes,
}
}

0 comments on commit 4849482

Please sign in to comment.