From 384137fe6814498e87a07cc5b74ae2bcb59f895b Mon Sep 17 00:00:00 2001 From: Markus Strauss Date: Fri, 28 Oct 2011 21:45:39 +0200 Subject: added a logdir parameter --- manifests/service.pp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/manifests/service.pp b/manifests/service.pp index 3258bec..0fed6d9 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -1,25 +1,28 @@ define runit::service ( - $user = root, # the service's user name - $group = root, # the service's group name - $enable = true, # shall the service be linked to /etc/service - $ensure = present, # shall the service be present in /etc/sv + $user = root, # the service's user name + $group = root, # the service's group name + $enable = true, # shall the service be linked to /etc/service + $ensure = present, # shall the service be present in /etc/sv # either one of these three must be declared - it defines the content of the run script /etc/sv/$name/run - $commmand = undef, # the most simple way; just state command here - it may not daemonize itself, - # but rather stay in the foreground; all output is logged automatically to $logdir/current - # this uses a default template which provides logging - $source = undef, # specify a source file on your puppet master - $content = undef, # specify the content directly (mostly via 'template') + $command = undef, # the most simple way; just state command here - it may not daemonize itself, + # but rather stay in the foreground; all output is logged automatically to $logdir/current + # this uses a default template which provides logging + $source = undef, # specify a source file on your puppet master + $content = undef, # specify the content directly (mostly via 'template') # service directory - this is required if you use 'command' - $rundir = undef, + $rundir = undef, # logging stuff - $logger = false, # shall we setup an logging service; if you use 'command' before, - # all output from command will be logged automatically to $logdir - $logdir = $svdir # override logging directory + $logger = true, # shall we setup an logging service; if you use 'command' before, + # all output from command will be logged automatically to $logdir/current + $logdir = "${rundir}/log" ) { # FixMe: Validate parameters # fail("Only one of 'command', 'content', or 'source' parameters is allowed") + if $command != undef and $rundir == undef { + fail( "You need to specify 'rundir': That's the directory from which the service will be started.") + } # resource defaults File { owner => root, group => root, mode => 644 } -- cgit v1.2.3