equal
deleted
inserted
replaced
|
1 # Define puppi::report |
|
2 # |
|
3 # This define creates a file with a report command that can be used locally. |
|
4 # |
|
5 # Usage: |
|
6 # puppi::report { "Retrieve files": |
|
7 # command => "report_mail.sh", |
|
8 # argument => "roots@example42.com", |
|
9 # priority => "10", |
|
10 # user => "root", |
|
11 # project => "spysite", |
|
12 # } |
|
13 # |
|
14 define puppi::report ( |
|
15 $project, |
|
16 $command, |
|
17 $arguments = '', |
|
18 $priority = '50', |
|
19 $user = 'root', |
|
20 $enable = true ) { |
|
21 |
|
22 require puppi::params |
|
23 |
|
24 # Autoinclude the puppi class |
|
25 include puppi |
|
26 |
|
27 $ensure = bool2ensure($enable) |
|
28 |
|
29 file { "${puppi::params::projectsdir}/${project}/report/${priority}-${name}": |
|
30 ensure => $ensure, |
|
31 mode => '0755', |
|
32 owner => $puppi::params::configfile_owner, |
|
33 group => $puppi::params::configfile_group, |
|
34 content => "su - ${user} -c \"export project=${project} && ${puppi::params::scriptsdir}/${command} ${arguments}\"\n", |
|
35 tag => 'puppi_report', |
|
36 } |
|
37 |
|
38 } |