make monit::pidcheck parameters optional
if not specified, default parameter values are derived from $name
1 parent 084bb7d commit b895a3396eafec09351a64d121762909b7fbdf9e
@Andreas Jaggi Andreas Jaggi authored on 8 Aug 2013
Showing 2 changed files
View
34
manifests/init.pp
require => File['/etc/monit/conf.d'],
}
}
 
define monit::pidcheck ($process_name, $pidfile, $start_prog, $stop_prog) {
define monit::pidcheck ($process_name = undef, $pidfile = undef, $start_prog = undef, $stop_prog = undef) {
$process_name_real = $process_name ? {
undef => $name,
default => $process_name,
}
$pidfile_real = $pidfile ? {
undef => "/var/run/${process_name_real}.pid",
default => $pidfile,
}
$start_prog_real = $start_prog ? {
undef => "/etc/init.d/${process_name_real} start",
default => $start_prog,
}
$stop_prog_real = $stop_prog ? {
undef => "/etc/init.d/${process_name_real} stop",
default => $stop_prog,
}
file { "/etc/monit/conf.d/$name":
mode => 600,
owner => root,
group => root,
View
6
templates/pidcheck.erb
#
# automatically generated by puppet for <%= fqdn %>, DO NOT MODIFY!
#
check process <%= process_name %> with pidfile <%= pidfile %>
start program = "<%= start_prog %>"
stop program = "<%= stop_prog %>"
check process <%= process_name_real %> with pidfile <%= pidfile_real %>
start program = "<%= start_prog_real %>"
stop program = "<%= stop_prog_real %>"