summaryrefslogtreecommitdiff
path: root/manifests/plugin.pp
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2011-03-25 00:01:54 -0400
committerMicah Anderson <micah@riseup.net>2011-03-25 00:01:54 -0400
commit5218993abef2a8bf79278d4d84123843279735c5 (patch)
tree8fe859ba86b83e4b9782ac19a37c89bf5cf5f0ba /manifests/plugin.pp
parentb3e29447187e289c60a4a9f7830032f1b10fae2f (diff)
parente7d23dabf191c5416197af0b229fc90b94539405 (diff)
Merge commit 'e7d23dabf191c5416197af0b229fc90b94539405'
Conflicts: manifests/client.pp manifests/client/base.pp manifests/client/darwin.pp manifests/client/debian.pp manifests/client/gentoo.pp manifests/client/openbsd.pp manifests/client/package.pp manifests/host.pp manifests/init.pp manifests/plugin.pp manifests/plugin/scriptpaths.pp manifests/plugins/interfaces.pp manifests/plugins/linux.pp manifests/plugins/vserver.pp manifests/register.pp manifests/register_snmp.pp manifests/remoteplugin.pp manifests/snmp_collector.pp
Diffstat (limited to 'manifests/plugin.pp')
-rw-r--r--manifests/plugin.pp93
1 files changed, 49 insertions, 44 deletions
diff --git a/manifests/plugin.pp b/manifests/plugin.pp
index 10aab79..08ac916 100644
--- a/manifests/plugin.pp
+++ b/manifests/plugin.pp
@@ -10,52 +10,57 @@ define munin::plugin (
$script_path_in = '',
$config = '' )
{
+ include munin::plugin::scriptpaths
+ $real_script_path = $script_path_in ? { '' => $munin::plugin::scriptpaths::script_path, default => $script_path_in }
- include munin::plugin::scriptpaths
- $real_script_path = $script_path_in ? { '' => $munin::plugin::scriptpaths::script_path, default => $script_path_in }
-
- $plugin_src = $ensure ? { "present" => $name, default => $ensure }
- $plugin = "/etc/munin/plugins/$name"
- $plugin_conf = "/etc/munin/plugin-conf.d/$name.conf"
-
- case $ensure {
- "absent": {
- file { $plugin: ensure => absent, }
- }
- default: {
- case $kernel {
- openbsd: { $basic_require = File['/var/run/munin'] }
- default: { $basic_require = Package['munin-node'] }
- }
- if $require { $real_require = [ $require, $basic_require ] }
- else {
- $real_require = $basic_require
- }
- file { $plugin:
- ensure => "${real_script_path}/${plugin_src}",
- require => $real_require,
- notify => Service['munin-node'];
- }
- }
- }
+ $plugin_src = $ensure ? { "present" => $name, default => $ensure }
+ $plugin = "/etc/munin/plugins/$name"
+ $plugin_conf = "/etc/munin/plugin-conf.d/$name.conf"
+
+ case $ensure {
+ "absent": {
+ file { $plugin: ensure => absent, }
+ }
+ default: {
+ case $kernel {
+ openbsd: { $basic_require = File['/var/run/munin'] }
+ default: { $basic_require = Package['munin-node'] }
+ }
+ if $require {
+ $real_require = [ $require, $basic_require ]
+ } else {
+ $real_require = $basic_require
+ }
+ file { $plugin:
+ ensure => "${real_script_path}/${plugin_src}",
+ require => $real_require,
+ notify => Service['munin-node'];
+ }
- case $config {
- '': { file { $plugin_conf: ensure => absent } }
- default: {
- case $ensure {
- absent: { file { $plugin_conf: ensure => absent } }
- default: {
- file { $plugin_conf:
- content => "[${name}]\n$config\n",
- mode => 0644, owner => root, group => 0,
- }
- if $require {
- File[$plugin_conf]{
- require +> $require,
+ }
+ }
+ case $config {
+ '': {
+ file { $plugin_conf: ensure => absent }
+ }
+ default: {
+ case $ensure {
+ absent: {
+ file { $plugin_conf: ensure => absent }
+ }
+ default: {
+ file { $plugin_conf:
+ content => "[${name}]\n$config\n",
+ mode => 0644, owner => root, group => 0,
+ }
+ if $require {
+ File[$plugin_conf]{
+ require +> $require,
+ }
+ }
+ }
}
- }
- }
- }
+ }
}
- }
}
+