From 3064a5d5a6251f84cf4d115be1711266faf7ed13 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 3 Nov 2013 18:21:57 +0100 Subject: fix #26 - do not manage files of a plugin if it should be absent The directories are recursively managed and will purge these files anyway and trigger a proper restart. Like that we can safe a few resources in our catalog. --- spec/defines/munin_plugin_spec.rb | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 spec/defines/munin_plugin_spec.rb (limited to 'spec/defines/munin_plugin_spec.rb') diff --git a/spec/defines/munin_plugin_spec.rb b/spec/defines/munin_plugin_spec.rb new file mode 100644 index 0000000..3d7e9e3 --- /dev/null +++ b/spec/defines/munin_plugin_spec.rb @@ -0,0 +1,40 @@ +require 'spec_helper' + +describe 'munin::plugin' do + let(:title) { 'users' } + let(:facts) do + { :operatingsystem => 'CentOS' } + end + context 'present' do + it { should contain_file('/etc/munin/plugins/users').with( + :ensure => 'link', + :target => '/usr/share/munin/plugins/users' + ) } + it { should_not contain_file('/etc/munin/plugin-conf.d/users.conf') } + end + + context 'present and config' do + let(:params) do + { :config => 'env.user root' } + end + it { should contain_file('/etc/munin/plugins/users').with( + :ensure => 'link', + :target => '/usr/share/munin/plugins/users', + :notify => 'Service[munin-node]' + ) } + it { should contain_file('/etc/munin/plugin-conf.d/users.conf').with( + :content => "[users]\nenv.user root\n", + :owner => 'root', + :group => 0, + :mode => '0640' + ) } + end + + context 'absent' do + let(:params) do + { :ensure => 'absent' } + end + it { should_not contain_file('/etc/munin/plugins/users') } + it { should_not contain_file('/etc/munin/plugin-conf.d/users.conf') } + end +end -- cgit v1.2.3 From 88d197da8cedd5d711db043995f725ebe66b6ed6 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 13 Jun 2014 12:25:48 +0200 Subject: implement #38 - allow config to be an array --- spec/defines/munin_plugin_spec.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'spec/defines/munin_plugin_spec.rb') diff --git a/spec/defines/munin_plugin_spec.rb b/spec/defines/munin_plugin_spec.rb index 3d7e9e3..0e7306a 100644 --- a/spec/defines/munin_plugin_spec.rb +++ b/spec/defines/munin_plugin_spec.rb @@ -30,6 +30,23 @@ describe 'munin::plugin' do ) } end + context 'present and config as an array' do + let(:params) do + { :config => [ 'env.user root', 'env.group root' ] } + end + it { should contain_file('/etc/munin/plugins/users').with( + :ensure => 'link', + :target => '/usr/share/munin/plugins/users', + :notify => 'Service[munin-node]' + ) } + it { should contain_file('/etc/munin/plugin-conf.d/users.conf').with( + :content => "[users]\nenv.user root\nenv.group root\n", + :owner => 'root', + :group => 0, + :mode => '0640' + ) } + end + context 'absent' do let(:params) do { :ensure => 'absent' } -- cgit v1.2.3