Skip to content

Commit 3018ce1

Browse files
alcyjamtur01
authored andcommitted
1 parent 60af17a commit 3018ce1

File tree

9 files changed

+33
-16
lines changed

9 files changed

+33
-16
lines changed

lib/puppet/feature/json.rb

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Puppet.features.add(:json, :libs => ["json"])

lib/puppet/provider/sensu_api_config/json.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
require 'rubygems' if RUBY_VERSION < '1.9.0'
2-
require 'json'
1+
require 'rubygems' if RUBY_VERSION < '1.9.0' && Puppet.features.rubygems?
2+
require 'json' if Puppet.features.json?
33

44
Puppet::Type.type(:sensu_api_config).provide(:json) do
5+
confine :feature => :json
6+
57
# Internal: Retrieve the current contents of /etc/sensu/config.json.
68
#
79
# Returns a Hash representation of the JSON structure in

lib/puppet/provider/sensu_check_config/json.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
require 'rubygems' if RUBY_VERSION < '1.9.0'
2-
require 'json'
1+
require 'rubygems' if RUBY_VERSION < '1.9.0' && Puppet.features.rubygems?
2+
require 'json' if Puppet.features.json?
33

44
Puppet::Type.type(:sensu_check_config).provide(:json) do
5+
confine :feature => :json
6+
57
def initialize(*args)
68
super
79

lib/puppet/provider/sensu_clean_config/json.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
require 'rubygems' if RUBY_VERSION < '1.9.0'
2-
require 'json'
1+
require 'rubygems' if RUBY_VERSION < '1.9.0' && Puppet.features.rubygems?
2+
require 'json' if Puppet.features.json?
33

44
Puppet::Type.type(:sensu_clean_config).provide(:json) do
5+
confine :feature => :json
6+
57
def conf
68
begin
79
@conf ||= JSON.parse(File.read('/etc/sensu/config.json'))

lib/puppet/provider/sensu_client_config/json.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
require 'rubygems' if RUBY_VERSION < '1.9.0'
2-
require 'json'
1+
require 'rubygems' if RUBY_VERSION < '1.9.0' && Puppet.features.rubygems?
2+
require 'json' if Puppet.features.json?
33

44
Puppet::Type.type(:sensu_client_config).provide(:json) do
5+
confine :feature => :json
6+
57
def initialize(*args)
68
super
79

lib/puppet/provider/sensu_dashboard_config/json.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
require 'rubygems' if RUBY_VERSION < '1.9.0'
2-
require 'json'
1+
require 'rubygems' if RUBY_VERSION < '1.9.0' && Puppet.features.rubygems?
2+
require 'json' if Puppet.features.json?
33

44
Puppet::Type.type(:sensu_dashboard_config).provide(:json) do
5+
confine :feature => :json
6+
57
def conf
68
begin
79
@conf ||= JSON.parse(File.read('/etc/sensu/config.json'))

lib/puppet/provider/sensu_handler_config/json.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
require 'rubygems' if RUBY_VERSION < '1.9.0'
2-
require 'json'
1+
require 'rubygems' if RUBY_VERSION < '1.9.0' && Puppet.features.rubygems?
2+
require 'json' if Puppet.features.json?
33

44
Puppet::Type.type(:sensu_handler_config).provide(:json) do
5+
confine :feature => :json
6+
57
def initialize(*args)
68
super
79

lib/puppet/provider/sensu_rabbitmq_config/json.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
require 'rubygems' if RUBY_VERSION < '1.9.0'
2-
require 'json'
1+
require 'rubygems' if RUBY_VERSION < '1.9.0' && Puppet.features.rubygems?
2+
require 'json' if Puppet.features.json?
33

44
Puppet::Type.type(:sensu_rabbitmq_config).provide(:json) do
5+
confine :feature => :json
6+
57
def conf
68
begin
79
@conf ||= JSON.parse(File.read('/etc/sensu/config.json'))

lib/puppet/provider/sensu_redis_config/json.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
require 'rubygems' if RUBY_VERSION < '1.9.0'
2-
require 'json'
1+
require 'rubygems' if RUBY_VERSION < '1.9.0' && Puppet.features.rubygems?
2+
require 'json' if Puppet.features.json?
33

44
Puppet::Type.type(:sensu_redis_config).provide(:json) do
5+
confine :feature => :json
6+
57
def conf
68
begin
79
@conf ||= JSON.parse(File.read('/etc/sensu/config.json'))

0 commit comments

Comments
 (0)