Skip to content

Commit

Permalink
move each service config to conf.d - no munging config.json
Browse files Browse the repository at this point in the history
  • Loading branch information
jlambert121 committed Feb 26, 2013
1 parent 63a649b commit e8eeb8b
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 }

This comment has been minimized.

Copy link
@KushalP

KushalP Dec 9, 2013

Having this line in place causes this module to fail for me as I can't start any sensu services. They all require that this file is present.

This comment has been minimized.

Copy link
@jlambert121

jlambert121 Dec 9, 2013

Author Contributor

What version of sensu are you running?

This comment has been minimized.

Copy link
@KushalP

KushalP via email Dec 9, 2013

This comment has been minimized.

Copy link
@jlambert121

jlambert121 Dec 9, 2013

Author Contributor

This code was merged long before the 0.7.5 version of this module, this refactoring I did in early 2013 before 0.5.0 was released. Looking at the 0.7.5 release of this file this code was there as well: https://github.com/sensu/sensu-puppet/blob/515a304bc44b9c18a93639a591914eb88c9ea2e4/manifests/package.pp

At one point sensu required the config.json to be present, but that hasn't been true for a while. Would you check the exact version of sensu you're using?

This comment has been minimized.

Copy link
@KushalP

KushalP Dec 9, 2013

I just checked and it appears to be an issue on my part. I needed to add a firewall rule to open up RabbitMQ access.

Sorry for any trouble I caused. And thank you for the fast response.

}
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 e8eeb8b

Please sign in to comment.