Skip to content

Commit

Permalink
install plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
jlambert121 committed Mar 1, 2013
1 parent 723cc66 commit e4ff243
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
5 changes: 4 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
$dashboard_password = 'secret',
$subscriptions = [],
$client_address = $::ipaddress,
$client_name = $::fqdn
$client_name = $::fqdn,
$plugins = []
){

Class['sensu::package'] ->
Expand Down Expand Up @@ -97,4 +98,6 @@

class { 'sensu::service::client': enabled => $client }

sensu::plugin { $plugins: install_path => '/etc/sensu/plugins'}

}
12 changes: 12 additions & 0 deletions manifests/plugin.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
define sensu::plugin(
$install_path = '/etc/sensu/plugins'
){

$filename = inline_template("<%= scope.lookupvar('name').split('/').last %>")

file { "${install_path}/${filename}":
ensure => file,
mode => '0555',
source => $name
}
}
6 changes: 5 additions & 1 deletion spec/classes/sensu_init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
:dashboard_password => 'dashpass',
:subscriptions => ['all'],
:client_address => '127.0.0.1',
:client_name => 'myhost'
:client_name => 'myhost',
:plugins => [ 'puppet:///data/plug1', 'puppet:///data/plug2' ]
} }

it { should contain_class('sensu::package').with(
Expand Down Expand Up @@ -111,6 +112,9 @@

it { should contain_class('sensu::service::server').with_enabled('true') }
it { should contain_class('sensu::service::client').with_enabled('false') }

it { should contain_sensu__plugin('puppet:///data/plug1') }
it { should contain_sensu__plugin('puppet:///data/plug2') }
end

context 'server and client' do
Expand Down
23 changes: 23 additions & 0 deletions spec/defines/sensu_plugin_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require 'spec_helper'

describe 'sensu::plugin', :type => :define do
let(:title) { 'puppet:///data/plug1' }

context 'defaults' do

it { should contain_file('/etc/sensu/plugins/plug1').with(
'source' => 'puppet:///data/plug1'
) }
end

context 'setting params' do
let(:params) { {
:install_path => '/var/sensu/plugins',
} }

it { should contain_file('/var/sensu/plugins/plug1').with(
'source' => 'puppet:///data/plug1'
) }
end

end

0 comments on commit e4ff243

Please sign in to comment.