Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
alcy authored and jamtur01 committed Feb 12, 2013
1 parent 60af17a commit 3018ce1
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 16 deletions.
1 change: 1 addition & 0 deletions lib/puppet/feature/json.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Puppet.features.add(:json, :libs => ["json"])
6 changes: 4 additions & 2 deletions lib/puppet/provider/sensu_api_config/json.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
require 'rubygems' if RUBY_VERSION < '1.9.0'
require 'json'
require 'rubygems' if RUBY_VERSION < '1.9.0' && Puppet.features.rubygems?
require 'json' if Puppet.features.json?

Puppet::Type.type(:sensu_api_config).provide(:json) do
confine :feature => :json

# Internal: Retrieve the current contents of /etc/sensu/config.json.
#
# Returns a Hash representation of the JSON structure in
Expand Down
6 changes: 4 additions & 2 deletions lib/puppet/provider/sensu_check_config/json.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
require 'rubygems' if RUBY_VERSION < '1.9.0'
require 'json'
require 'rubygems' if RUBY_VERSION < '1.9.0' && Puppet.features.rubygems?
require 'json' if Puppet.features.json?

Puppet::Type.type(:sensu_check_config).provide(:json) do
confine :feature => :json

def initialize(*args)
super

Expand Down
6 changes: 4 additions & 2 deletions lib/puppet/provider/sensu_clean_config/json.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
require 'rubygems' if RUBY_VERSION < '1.9.0'
require 'json'
require 'rubygems' if RUBY_VERSION < '1.9.0' && Puppet.features.rubygems?
require 'json' if Puppet.features.json?

Puppet::Type.type(:sensu_clean_config).provide(:json) do
confine :feature => :json

def conf
begin
@conf ||= JSON.parse(File.read('/etc/sensu/config.json'))
Expand Down
6 changes: 4 additions & 2 deletions lib/puppet/provider/sensu_client_config/json.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
require 'rubygems' if RUBY_VERSION < '1.9.0'
require 'json'
require 'rubygems' if RUBY_VERSION < '1.9.0' && Puppet.features.rubygems?
require 'json' if Puppet.features.json?

Puppet::Type.type(:sensu_client_config).provide(:json) do
confine :feature => :json

def initialize(*args)
super

Expand Down
6 changes: 4 additions & 2 deletions lib/puppet/provider/sensu_dashboard_config/json.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
require 'rubygems' if RUBY_VERSION < '1.9.0'
require 'json'
require 'rubygems' if RUBY_VERSION < '1.9.0' && Puppet.features.rubygems?
require 'json' if Puppet.features.json?

Puppet::Type.type(:sensu_dashboard_config).provide(:json) do
confine :feature => :json

def conf
begin
@conf ||= JSON.parse(File.read('/etc/sensu/config.json'))
Expand Down
6 changes: 4 additions & 2 deletions lib/puppet/provider/sensu_handler_config/json.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
require 'rubygems' if RUBY_VERSION < '1.9.0'
require 'json'
require 'rubygems' if RUBY_VERSION < '1.9.0' && Puppet.features.rubygems?
require 'json' if Puppet.features.json?

Puppet::Type.type(:sensu_handler_config).provide(:json) do
confine :feature => :json

def initialize(*args)
super

Expand Down
6 changes: 4 additions & 2 deletions lib/puppet/provider/sensu_rabbitmq_config/json.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
require 'rubygems' if RUBY_VERSION < '1.9.0'
require 'json'
require 'rubygems' if RUBY_VERSION < '1.9.0' && Puppet.features.rubygems?
require 'json' if Puppet.features.json?

Puppet::Type.type(:sensu_rabbitmq_config).provide(:json) do
confine :feature => :json

def conf
begin
@conf ||= JSON.parse(File.read('/etc/sensu/config.json'))
Expand Down
6 changes: 4 additions & 2 deletions lib/puppet/provider/sensu_redis_config/json.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
require 'rubygems' if RUBY_VERSION < '1.9.0'
require 'json'
require 'rubygems' if RUBY_VERSION < '1.9.0' && Puppet.features.rubygems?
require 'json' if Puppet.features.json?

Puppet::Type.type(:sensu_redis_config).provide(:json) do
confine :feature => :json

def conf
begin
@conf ||= JSON.parse(File.read('/etc/sensu/config.json'))
Expand Down

0 comments on commit 3018ce1

Please sign in to comment.