Skip to content

Commit

Permalink
sensu-plugin: Allow one to install the gem
Browse files Browse the repository at this point in the history
This PR aims to allow an administrator to decide to install
the sensu-plugin gem or not.
  • Loading branch information
Spredzy committed Jul 31, 2014
1 parent 6243d1a commit 0c792d2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
7 changes: 7 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
# Default: latest
# Valid values: absent, installed, latest, present, [\d\.\-]+
#
# [*sensu_plugin_version*]
# String. Version of the sensu-plugin gem to install
# Default: absent
# Valid values: absent, installed, latest, present, [\d\.\-]+
#
# [*install_repo*]
# Boolean. Whether or not to install the sensu repo
# Default: true
Expand Down Expand Up @@ -180,6 +185,7 @@
#
class sensu (
$version = 'latest',
$sensu_plugin_version = 'absent',
$install_repo = true,
$repo = 'main',
$repo_source = undef,
Expand Down Expand Up @@ -227,6 +233,7 @@

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}")
validate_re($sensu_plugin_version, ['^absent$', '^installed$', '^latest$', '^present$', '^[\d\.\-]+$'], "Invalid sensu-plugin package version: ${sensu_plugin_version}")
validate_re($log_level, ['^debug$', '^info$', '^warn$', '^error$', '^fatal$'] )
if !is_integer($rabbitmq_port) { fail('rabbitmq_port must be an integer') }
if !is_integer($redis_port) { fail('redis_port must be an integer') }
Expand Down
5 changes: 5 additions & 0 deletions manifests/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
ensure => $sensu::version,
}

package { 'sensu-plugin' :
ensure => $sensu::sensu_plugin_version,
provider => 'gem',
}

file { '/etc/default/sensu':
ensure => file,
content => template("${module_name}/sensu.erb"),
Expand Down
8 changes: 7 additions & 1 deletion spec/classes/sensu_package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@

context 'setting version' do
let(:params) { {
:version => '0.9.10',
:version => '0.9.10',
:sensu_plugin_version => 'installed',
} }

it { should contain_package('sensu').with(
:ensure => '0.9.10'
) }

it { should contain_package('sensu-plugin').with(
:ensure => 'installed',
:provider => 'gem'
) }
end

context 'repos' do
Expand Down

0 comments on commit 0c792d2

Please sign in to comment.