1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
require 'spec_helper'
describe 'munin::host::cgi' do
#let :pre_condition do
# 'include munin::client'
#end
context 'on Debian' do
let :facts do
{ :operatingsystem => 'Debian' }
end
it 'should compile' do
should contain_class('munin::host::cgi')
end
it 'should exec set_modes_for_cgi' do
should contain_exec('set_modes_for_cgi').with({
:command => 'chgrp www-data /var/log/munin /var/log/munin/munin-graph.log && chmod g+w /var/log/munin /var/log/munin/munin-graph.log && find /var/www/munin/* -maxdepth 1 -type d -exec chgrp -R www-data {} \; && find /var/www/munin/* -maxdepth 1 -type d -exec chmod -R g+w {} \;',
:refreshonly => true,
:subscribe => 'Concat::Fragment[munin.conf.header]',
})
end
it 'should contain logrotate.conf' do
should contain_file('/etc/logrotate.d/munin').with({
:content => /^ create 660 munin www-data$/,
:group => 0,
:mode => '0644',
:owner => 'root',
})
end
end
context 'on CentOS' do
let :facts do
{ :operatingsystem => 'CentOS' }
end
it 'should exec set_modes_for_cgi' do
should contain_exec('set_modes_for_cgi').with({
:command => 'chgrp apache /var/log/munin /var/log/munin/munin-graph.log && chmod g+w /var/log/munin /var/log/munin/munin-graph.log && find /var/www/html/munin/* -maxdepth 1 -type d -exec chgrp -R apache {} \; && find /var/www/html/munin/* -maxdepth 1 -type d -exec chmod -R g+w {} \;',
:refreshonly => true,
:subscribe => 'Concat::Fragment[munin.conf.header]',
})
end
it 'should contain logrotate.conf' do
should contain_file('/etc/logrotate.d/munin').with({
:content => /^ create 660 munin apache$/,
:group => 0,
:mode => '0644',
:owner => 'root',
})
end
end
end
|