Skip to content

Commit

Permalink
Allow undef handlers and subscribers
Browse files Browse the repository at this point in the history
This commit fixes the error message: `undefined method `sort' for
nil:NilClass`. This error message can be seen when either the handlers
or subscribers parameters are passed in as  `undef` in the check.pp
manifest.

The PRs that looks like they introduced this behavior are:
#285
#303
  • Loading branch information
Alejandro Figueroa committed Aug 18, 2016
1 parent d21d863 commit 29740a1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/puppet/type/sensu_check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ def insync?(is)
newproperty(:handlers, :array_matching => :all) do
desc "List of handlers that responds to this check"
def insync?(is)
is.sort == should.sort
return is.sort == should.sort if is.is_a?(Array) && should.is_a?(Array)
is == should
end
end

Expand Down Expand Up @@ -81,7 +82,8 @@ def insync?(is)
newproperty(:subscribers, :array_matching => :all) do
desc "Who is subscribed to this check"
def insync?(is)
is.sort == should.sort
return is.sort == should.sort if is.is_a?(Array) && should.is_a?(Array)
is == should
end
end

Expand Down

0 comments on commit 29740a1

Please sign in to comment.