Skip to content

Commit

Permalink
Don't set empty arrays for subscribers/handlers
Browse files Browse the repository at this point in the history
 - empty array for check-handler avoids sensu-server to use default
   handler
 - I don't want to set default handler on all puppet checks
  • Loading branch information
LarsFronius committed Sep 24, 2013
1 parent 2b09855 commit 41925b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/puppet/provider/sensu_check/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ def flush
def create
conf['checks'] = {}
conf['checks'][resource[:name]] = {}
self.handlers = resource[:handlers]
self.command = resource[:command]
self.interval = resource[:interval]
self.subscribers = resource[:subscribers]
# Optional arguments
self.handlers = resource[:handlers] unless resource[:handlers].nil?
self.subscribers = resource[:subscribers] unless resource[:subscribers].nil?
self.type = resource[:type] unless resource[:type].nil?
self.standalone = resource[:standalone] unless resource[:standalone].nil?
self.high_flap_threshold = resource[:high_flap_threshold] unless resource[:high_flap_threshold].nil?
Expand Down Expand Up @@ -83,7 +83,7 @@ def interval=(value)
end

def handlers
conf['checks'][resource[:name]]['handlers'] || []
conf['checks'][resource[:name]]['handlers']
end

def handlers=(value)
Expand All @@ -99,7 +99,7 @@ def command=(value)
end

def subscribers
conf['checks'][resource[:name]]['subscribers'] || []
conf['checks'][resource[:name]]['subscribers']
end

def subscribers=(value)
Expand Down
4 changes: 2 additions & 2 deletions manifests/check.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
$command,
$ensure = 'present',
$type = undef,
$handlers = [],
$handlers = undef,
$standalone = true,
$interval = '60',
$subscribers = [],
$subscribers = undef,
$low_flap_threshold = undef,
$high_flap_threshold = undef,
$custom = undef,
Expand Down

0 comments on commit 41925b7

Please sign in to comment.