Skip to content

Commit

Permalink
Use the purge_config flag to purge plugins/handlers/extensions/mutators
Browse files Browse the repository at this point in the history
  • Loading branch information
nhinds committed Jan 26, 2015
1 parent 5886615 commit c54d234
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
8 changes: 1 addition & 7 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,6 @@
# Default: false
# Valid values: true, false
#
# [*purge_scripts*]
# Boolean. If unused plugins, handlers, extensions and mutators should be removed from the system
# Default: false
# Valid values: true, false
#
# [*use_embedded_ruby*]
# Boolean. If the embedded ruby should be used
# Default: false
Expand Down Expand Up @@ -239,15 +234,14 @@
$plugins = [],
$plugins_dir = undef,
$purge_config = false,
$purge_scripts = false,
$use_embedded_ruby = false,
$rubyopt = '',
$gem_path = '',
$log_level = 'info',
$dashboard = false,
){

validate_bool($client, $server, $api, $install_repo, $purge_config, $purge_scripts, $safe_mode, $manage_services)
validate_bool($client, $server, $api, $install_repo, $purge_config, $safe_mode, $manage_services)

validate_re($repo, ['^main$', '^unstable$'], "Repo must be 'main' or 'unstable'. Found: ${repo}")
validate_re($version, ['^absent$', '^installed$', '^latest$', '^present$', '^[\d\.\-]+$'], "Invalid package version: ${version}")
Expand Down
4 changes: 2 additions & 2 deletions manifests/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
owner => 'sensu',
group => 'sensu',
recurse => true,
purge => $sensu::purge_scripts,
purge => $sensu::purge_config,
require => Package['sensu'],
}

Expand All @@ -87,7 +87,7 @@
owner => 'sensu',
group => 'sensu',
recurse => true,
purge => $sensu::purge_scripts,
purge => $sensu::purge_config,
require => Package['sensu'],
}
}
Expand Down
18 changes: 4 additions & 14 deletions spec/classes/sensu_package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,13 @@
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',
:purge => false
) }
end
[ '/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
:purge => false
) }
end
it { should contain_file('/etc/sensu/config.json').with_ensure('absent') }
Expand Down Expand Up @@ -160,11 +155,6 @@
) }
end

end

context 'purge_scripts' do
let(:params) { { :purge_scripts => true } }

[ '/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(
Expand Down

0 comments on commit c54d234

Please sign in to comment.