Skip to content

Commit

Permalink
Merge pull request #21 from Kasen/master
Browse files Browse the repository at this point in the history
The attribute ['nrpe']['checks'], which stores all configured checks.
  • Loading branch information
sbotman committed Feb 13, 2015
2 parents f8bcd89 + eeb8c71 commit af28f20
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: ruby
rvm:
- 1.9.3
- 2.0.0
- 2.1.1
script:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source 'https://rubygems.org'
gem 'berkshelf', '~> 3.2.0'
gem 'chefspec', '~> 4.2.0'
gem 'foodcritic', '~> 4.0.0'
gem 'rubocop', '~> 0.8.0'
gem 'rubocop', '~> 0.28.0'

group :integration do
gem 'test-kitchen', '~> 1.3.1'
Expand Down
3 changes: 3 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
# this is mostly true except for centos-70
default['nrpe']['check_action'] = 'reload'

# attribute for storing information about checks on the node
default['nrpe']['checks'] = []

# platform specific values
case node['platform_family']
when 'debian'
Expand Down
8 changes: 8 additions & 0 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,11 @@
action [:start, :enable]
supports :restart => true, :reload => true, :status => true
end

# The updating of the list of checks.
ruby_block 'updating of the list of checks' do
block do
checks = run_context.resource_collection.select { |r| r.is_a?(Chef::Resource::NrpeCheck) && r.action == [:add] }.map(&:command_name)
node.set['nrpe']['checks'] = checks
end
end

0 comments on commit af28f20

Please sign in to comment.