Skip to content

Commit

Permalink
Merge pull request #19 from jlambert121/config_json_gone
Browse files Browse the repository at this point in the history
move each service config to conf.d - no munging config.json
  • Loading branch information
jamtur01 committed Feb 27, 2013
2 parents 63a649b + e8eeb8b commit 239969a
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 59 deletions.
4 changes: 2 additions & 2 deletions lib/puppet/provider/sensu_api_config/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# /etc/sensu/config.json or an empty Hash if the file can not be read.
def conf
begin
@conf ||= JSON.parse(File.read('/etc/sensu/config.json'))
@conf ||= JSON.parse(File.read('/etc/sensu/conf.d/api.json'))
rescue
@conf ||= {}
end
Expand All @@ -20,7 +20,7 @@ def conf
#
# Returns nothing.
def flush
File.open('/etc/sensu/config.json', 'w') do |f|
File.open('/etc/sensu/conf.d/api.json', 'w') do |f|
f.puts JSON.pretty_generate(@conf)
end
end
Expand Down
30 changes: 0 additions & 30 deletions lib/puppet/provider/sensu_clean_config/json.rb

This file was deleted.

4 changes: 2 additions & 2 deletions lib/puppet/provider/sensu_dashboard_config/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

def conf
begin
@conf ||= JSON.parse(File.read('/etc/sensu/config.json'))
@conf ||= JSON.parse(File.read('/etc/sensu/conf.d/dashboard.json'))
rescue
@conf ||= {}
end
end

def flush
File.open('/etc/sensu/config.json', 'w') do |f|
File.open('/etc/sensu/conf.d/dashboard.json', 'w') do |f|
f.puts JSON.pretty_generate(conf)
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/puppet/provider/sensu_rabbitmq_config/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

def conf
begin
@conf ||= JSON.parse(File.read('/etc/sensu/config.json'))
@conf ||= JSON.parse(File.read('/etc/sensu/conf.d/rabbitmq.json'))
rescue
@conf ||= {}
end
end

def flush
File.open('/etc/sensu/config.json', 'w') do |f|
File.open('/etc/sensu/conf.d/rabbitmq.json', 'w') do |f|
f.puts JSON.pretty_generate(conf)
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/puppet/provider/sensu_redis_config/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

def conf
begin
@conf ||= JSON.parse(File.read('/etc/sensu/config.json'))
@conf ||= JSON.parse(File.read('/etc/sensu/conf.d/redis.json'))
rescue
@conf ||= {}
end
end

def flush
File.open('/etc/sensu/config.json', 'w') do |f|
File.open('/etc/sensu/conf.d/redis.json', 'w') do |f|
f.puts JSON.pretty_generate(conf)
end
end
Expand Down
19 changes: 0 additions & 19 deletions lib/puppet/type/sensu_clean_config.rb

This file was deleted.

2 changes: 1 addition & 1 deletion manifests/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
notify => $notify_services
}

sensu_clean_config { $::fqdn: }
file { '/etc/sensu/config.json': ensure => absent }
}
2 changes: 1 addition & 1 deletion spec/classes/sensu_package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
it { should create_class('sensu::package') }
it { should include_class('sensu::repo') }
it { should contain_package('sensu').with_ensure('latest') }
it { should contain_sensu_clean_config('testhost.domain.com') }
it { should contain_file('/etc/sensu/config.json').with_ensure('absent') }
end

context 'setting parameters' do
Expand Down

0 comments on commit 239969a

Please sign in to comment.