Skip to content

Commit

Permalink
Merge pull request #151 from crewton/master
Browse files Browse the repository at this point in the history
make booleans booleans and fix filters
  • Loading branch information
jlambert121 committed Feb 7, 2014
2 parents d6d6dee + e7e3c7a commit 14af9a3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
5 changes: 3 additions & 2 deletions lib/puppet/provider/sensu_handler/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def create
self.handlers = resource[:handlers] unless resource[:handlers].nil?
self.mutator = resource[:mutator] unless resource[:mutator].nil?
self.severities = resource[:severities] unless resource[:severities].nil?
self.filters = resource[:filters] unless resource[:filters].nil?
end

def destroy
Expand Down Expand Up @@ -99,9 +100,9 @@ def filters

def filters=(value)
if value.is_a?(Array)
@conf['filters'][resource[:name]]['filters'] = value
@conf['handlers'][resource[:name]]['filters'] = value
else
@conf['filters'][resource[:name]]['filters'] = [ value ]
@conf['handlers'][resource[:name]]['filters'] = [ value ]
end
end

Expand Down
12 changes: 9 additions & 3 deletions lib/puppet/type/sensu_check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,22 @@ def insync?(is)
desc "Check timeout in seconds, after it fails"
end

newproperty(:aggregate) do
newproperty(:aggregate, :boolean => true) do
desc "Whether check is aggregate"

newvalues(:true, :false)
end

newproperty(:handle) do
newproperty(:handle, :boolean => true) do
desc "Whether check event send to a handler"

newvalues(:true, :false)
end

newproperty(:publish) do
newproperty(:publish, :boolean => true) do
desc "Whether check is unpublished"

newvalues(:true, :false)
end

autorequire(:package) do
Expand Down
4 changes: 3 additions & 1 deletion lib/puppet/type/sensu_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ def insync?(is)
defaultto {}
end

newproperty(:negate) do
newproperty(:negate, :boolean => true) do
desc ""

newvalues(:true, :false)
end

autorequire(:package) do
Expand Down
2 changes: 1 addition & 1 deletion manifests/filter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
owner => 'sensu',
group => 'sensu',
mode => '0444',
before => Sensu_client_subscription[$name],
before => Sensu_filter[$name],
}

sensu_filter { $name:
Expand Down

0 comments on commit 14af9a3

Please sign in to comment.