Skip to content

Commit

Permalink
Merge pull request #302 from nhinds/purge-scripts
Browse files Browse the repository at this point in the history
Add parameter to allow purging plugins, handlers, extensions and mutators
  • Loading branch information
jlambert121 committed Jan 26, 2015
2 parents c989c97 + 4b9daf0 commit 6e1f607
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
14 changes: 5 additions & 9 deletions manifests/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
require => Package['sensu'],
}

file { [ '/etc/sensu/conf.d', '/etc/sensu/conf.d/handlers', '/etc/sensu/conf.d/checks', '/etc/sensu/conf.d/filters', '/etc/sensu/conf.d/extensions' ]:
file { [ '/etc/sensu/conf.d', '/etc/sensu/conf.d/handlers', '/etc/sensu/conf.d/checks', '/etc/sensu/conf.d/filters', '/etc/sensu/conf.d/extensions',
'/etc/sensu/handlers', '/etc/sensu/extensions', '/etc/sensu/mutators', '/etc/sensu/extensions/handlers' ]:
ensure => directory,
owner => 'sensu',
group => 'sensu',
Expand All @@ -70,20 +71,15 @@
require => Package['sensu'],
}

file { ['/etc/sensu/handlers', '/etc/sensu/extensions', '/etc/sensu/mutators', '/etc/sensu/extensions/handlers']:
ensure => directory,
mode => '0555',
owner => 'sensu',
group => 'sensu',
require => Package['sensu'],
}

if $sensu::_manage_plugins_dir {
file { '/etc/sensu/plugins':
ensure => directory,
mode => '0555',
owner => 'sensu',
group => 'sensu',
purge => $sensu::purge_config,
recurse => true,
force => true,
require => Package['sensu'],
}
}
Expand Down
10 changes: 7 additions & 3 deletions spec/classes/sensu_package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
it { should create_class('sensu::package') }
it { should contain_package('sensu').with_ensure('latest') }
it { should contain_file('/etc/default/sensu') }
[ '/etc/sensu/conf.d', '/etc/sensu/conf.d/handlers', '/etc/sensu/conf.d/checks' ].each do |dir|
[ '/etc/sensu/conf.d', '/etc/sensu/conf.d/handlers', '/etc/sensu/conf.d/checks',
'/etc/sensu/handlers', '/etc/sensu/extensions', '/etc/sensu/mutators',
'/etc/sensu/extensions/handlers', '/etc/sensu/plugins'].each do |dir|
it { should contain_file(dir).with(
:ensure => 'directory',
:recurse => true,
:purge => false
) }
end
Expand Down Expand Up @@ -143,15 +146,16 @@
context 'purge_config' do
let(:params) { { :purge_config => true } }

[ '/etc/sensu/conf.d', '/etc/sensu/conf.d/handlers', '/etc/sensu/conf.d/checks' ].each do |dir|
[ '/etc/sensu/conf.d', '/etc/sensu/conf.d/handlers', '/etc/sensu/conf.d/checks',
'/etc/sensu/handlers', '/etc/sensu/extensions', '/etc/sensu/mutators',
'/etc/sensu/extensions/handlers', '/etc/sensu/plugins' ].each do |dir|
it { should contain_file(dir).with(
:ensure => 'directory',
:purge => true,
:recurse => true,
:force => true
) }
end

end
end

Expand Down

0 comments on commit 6e1f607

Please sign in to comment.