From e2dfae5852ecdf3695a6af8ec48092ea24698390 Mon Sep 17 00:00:00 2001 From: "Christian G. Warden" Date: Thu, 2 Feb 2012 18:10:14 -0800 Subject: Fully qualify facter variables --- manifests/plugin/deploy.pp | 2 +- manifests/plugin/scriptpaths.pp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'manifests/plugin') diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 67cbfb8..7de8d45 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -15,7 +15,7 @@ define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') { mode => 0755, owner => root, group => 0; } - case $kernel { + case $::kernel { openbsd: { $basic_require = File['/var/run/munin'] } default: { $basic_require = Package['munin-node'] } } diff --git a/manifests/plugin/scriptpaths.pp b/manifests/plugin/scriptpaths.pp index 164a17e..f4bd39b 100644 --- a/manifests/plugin/scriptpaths.pp +++ b/manifests/plugin/scriptpaths.pp @@ -1,9 +1,9 @@ class munin::plugin::scriptpaths { - case $operatingsystem { + case $::operatingsystem { gentoo: { $script_path = "/usr/libexec/munin/plugins" } debian: { $script_path = "/usr/share/munin/plugins" } centos: { $script_path = "/usr/share/munin/plugins" } - openbsd: { $script_path = $operatingsystemrelease ? { + openbsd: { $script_path = $::operatingsystemrelease ? { '4.3' => '/opt/munin/lib/plugins/', default => '/usr/local/libexec/munin/plugins/' } } -- cgit v1.2.3 From d459255da087bda68627dc5c228056b6ebf7036b Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 15 Feb 2012 18:17:14 +0100 Subject: manage selinux if enabled of plugins we manage --- manifests/plugin/deploy.pp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'manifests/plugin') diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 67cbfb8..be7748b 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -15,7 +15,14 @@ define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') { mode => 0755, owner => root, group => 0; } - case $kernel { + + if $::selinux == 'true' { + File["munin_plugin_${name}"]{ + setype => 'munin_services_plugin_exec_t', + } + } + + case $::kernel { openbsd: { $basic_require = File['/var/run/munin'] } default: { $basic_require = Package['munin-node'] } } -- cgit v1.2.3 From 71d458239f7e8f175c3180d95f0b7770aea91ff0 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 15 Feb 2012 18:25:11 +0100 Subject: correct param --- manifests/plugin/deploy.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/plugin') diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index be7748b..a76bc6e 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -18,7 +18,7 @@ define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') { if $::selinux == 'true' { File["munin_plugin_${name}"]{ - setype => 'munin_services_plugin_exec_t', + seltype => 'munin_services_plugin_exec_t', } } -- cgit v1.2.3 From df6d136c29b035616ba5bbf5efd9b16f3a22338e Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 16 Feb 2012 15:57:22 +0100 Subject: set correct labels for munin plugins --- manifests/plugin/deploy.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/plugin') diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index a76bc6e..86ca7f5 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -18,7 +18,7 @@ define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') { if $::selinux == 'true' { File["munin_plugin_${name}"]{ - seltype => 'munin_services_plugin_exec_t', + seltype => 'munin_exec_t', } } -- cgit v1.2.3 From f2a0d2623b36e6105f31e51d99cbd349adaa30d7 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 25 Feb 2012 13:54:48 +0100 Subject: CentOS 5 does not yet have a munin policy --- manifests/plugin/deploy.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/plugin') diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 86ca7f5..094b490 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -16,7 +16,7 @@ define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') { } - if $::selinux == 'true' { + if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ File["munin_plugin_${name}"]{ seltype => 'munin_exec_t', } -- cgit v1.2.3 From 9fd1de5acd9064a0d67ca9d2c13a829a3f628f39 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 5 Jun 2012 19:39:49 -0300 Subject: new style for 2.7 --- manifests/plugin/deploy.pp | 72 ++++++++++++++++++++--------------------- manifests/plugin/scriptpaths.pp | 20 ++++++------ 2 files changed, 46 insertions(+), 46 deletions(-) (limited to 'manifests/plugin') diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 5003153..9e74afb 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -1,43 +1,43 @@ define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') { - $plugin_src = $ensure ? { - 'present' => $name, - 'absent' => $name, - default => $ensure - } - $real_source = $source ? { - '' => "munin/plugins/$plugin_src", - default => $source - } - include munin::plugin::scriptpaths - file { "munin_plugin_${name}": - path => "$munin::plugin::scriptpaths::script_path/${name}", - source => "puppet:///modules/$real_source", - mode => 0755, owner => root, group => 0; - } + $plugin_src = $ensure ? { + 'present' => $name, + 'absent' => $name, + default => $ensure + } + $real_source = $source ? { + '' => "munin/plugins/$plugin_src", + default => $source + } + include munin::plugin::scriptpaths + file { "munin_plugin_${name}": + path => "${munin::plugin::scriptpaths::script_path}/${name}", + source => "puppet:///modules/${real_source}", + mode => 0755, owner => root, group => 0; + } - if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ - File["munin_plugin_${name}"]{ - seltype => 'munin_exec_t', - } + if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ + File["munin_plugin_${name}"]{ + seltype => 'munin_exec_t', } + } - case $::kernel { - openbsd: { $basic_require = File['/var/run/munin'] } - default: { $basic_require = Package['munin-node'] } - } - if $require { - File["munin_plugin_${name}"]{ - require => [ $basic_require, $require ], - } - } else { - File["munin_plugin_${name}"]{ - require => $basic_require, - } + case $::kernel { + openbsd: { $basic_require = File['/var/run/munin'] } + default: { $basic_require = Package['munin-node'] } + } + if $require { + File["munin_plugin_${name}"]{ + require => [ $basic_require, $require ], } - # register the plugin - if $require { - munin::plugin{$name: ensure => $ensure, config => $config, require => $require } - } else { - munin::plugin{$name: ensure => $ensure, config => $config } + } else { + File["munin_plugin_${name}"]{ + require => $basic_require, } + } + # register the plugin + if $require { + munin::plugin{$name: ensure => $ensure, config => $config, require => $require } + } else { + munin::plugin{$name: ensure => $ensure, config => $config } + } } diff --git a/manifests/plugin/scriptpaths.pp b/manifests/plugin/scriptpaths.pp index f4bd39b..2cad97b 100644 --- a/manifests/plugin/scriptpaths.pp +++ b/manifests/plugin/scriptpaths.pp @@ -1,12 +1,12 @@ class munin::plugin::scriptpaths { - case $::operatingsystem { - gentoo: { $script_path = "/usr/libexec/munin/plugins" } - debian: { $script_path = "/usr/share/munin/plugins" } - centos: { $script_path = "/usr/share/munin/plugins" } - openbsd: { $script_path = $::operatingsystemrelease ? { - '4.3' => '/opt/munin/lib/plugins/', - default => '/usr/local/libexec/munin/plugins/' - } } - default: { $script_path = "/usr/share/munin/plugins" } - } + case $::operatingsystem { + gentoo: { $script_path = "/usr/libexec/munin/plugins" } + debian: { $script_path = "/usr/share/munin/plugins" } + centos: { $script_path = "/usr/share/munin/plugins" } + openbsd: { $script_path = $::operatingsystemrelease ? { + '4.3' => '/opt/munin/lib/plugins/', + default => '/usr/local/libexec/munin/plugins/' + } } + default: { $script_path = "/usr/share/munin/plugins" } + } } -- cgit v1.2.3 From 61cfbbf42268045b0d4f0dc0481b962e9aad9f8f Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 28 Feb 2013 20:21:53 +0100 Subject: linting --- manifests/plugin/deploy.pp | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'manifests/plugin') diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 9e74afb..2928a3a 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -1,18 +1,25 @@ -define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') { +# deploy and register a munin plugin +define munin::plugin::deploy( + $ensure = 'present', + $source = '', + $config = '', +) { $plugin_src = $ensure ? { 'present' => $name, - 'absent' => $name, - default => $ensure + 'absent' => $name, + default => $ensure } $real_source = $source ? { - '' => "munin/plugins/$plugin_src", + '' => "munin/plugins/${plugin_src}", default => $source } include munin::plugin::scriptpaths file { "munin_plugin_${name}": - path => "${munin::plugin::scriptpaths::script_path}/${name}", - source => "puppet:///modules/${real_source}", - mode => 0755, owner => root, group => 0; + path => "${munin::plugin::scriptpaths::script_path}/${name}", + source => "puppet:///modules/${real_source}", + owner => root, + group => 0, + mode => '0755'; } if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ @@ -35,9 +42,13 @@ define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') { } } # register the plugin + munin::plugin{$name: + ensure => $ensure, + config => $config + } if $require { - munin::plugin{$name: ensure => $ensure, config => $config, require => $require } - } else { - munin::plugin{$name: ensure => $ensure, config => $config } + Munin::Plugin[$name]{ + require => $require + } } } -- cgit v1.2.3 From f047c5c38310c25a4f5483cd33caba6d73a42ab0 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 28 Feb 2013 20:23:10 +0100 Subject: this require is pretty useless, as if we have a require on the define, we do not need to pass it down --- manifests/plugin/deploy.pp | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'manifests/plugin') diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 2928a3a..53f6481 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -2,7 +2,7 @@ define munin::plugin::deploy( $ensure = 'present', $source = '', - $config = '', + $config = '' ) { $plugin_src = $ensure ? { 'present' => $name, @@ -32,23 +32,12 @@ define munin::plugin::deploy( openbsd: { $basic_require = File['/var/run/munin'] } default: { $basic_require = Package['munin-node'] } } - if $require { - File["munin_plugin_${name}"]{ - require => [ $basic_require, $require ], - } - } else { - File["munin_plugin_${name}"]{ - require => $basic_require, - } + File["munin_plugin_${name}"]{ + require => $basic_require, } # register the plugin munin::plugin{$name: ensure => $ensure, config => $config } - if $require { - Munin::Plugin[$name]{ - require => $require - } - } } -- cgit v1.2.3 From 77e0a70999a8c4c20ee8d9eb521b927c525ac653 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 28 Feb 2013 20:24:02 +0100 Subject: make it possible to manage the seltype --- manifests/plugin/deploy.pp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'manifests/plugin') diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 53f6481..cbf64fb 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -1,8 +1,9 @@ # deploy and register a munin plugin define munin::plugin::deploy( - $ensure = 'present', - $source = '', - $config = '' + $ensure = 'present', + $source = '', + $config = '', + $seltype = 'munin_exec_t' ) { $plugin_src = $ensure ? { 'present' => $name, @@ -24,7 +25,7 @@ define munin::plugin::deploy( if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ File["munin_plugin_${name}"]{ - seltype => 'munin_exec_t', + seltype => $seltype, } } -- cgit v1.2.3