-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filters throwing failed: 'undefined method `sort' for nil:NilClass' error #374
Comments
Ran into this as well today. The problem is that handler config file on the filesystem does not include "filters" key (because its current default is undef). As a result, variable "is" at https://github.com/sensu/sensu-puppet/blob/master/lib/puppet/type/sensu_handler.rb#L74 is nil. There are many ways how this can be fixed. sensu_handler type (see above) can check for nil. Or https://github.com/sensu/sensu-puppet/blob/master/lib/puppet/provider/sensu_handler/json.rb#L104 can become "conf['handlers'][resource[:name]]['filters'] || [ ]". Or default for $filters at https://github.com/sensu/sensu-puppet/blob/master/manifests/handler.pp#L72 can be changed to [ ] instead of undef, and add validate_array($filters). The latter approach could be the best in the long run but by itself it will break puppet on the first run for all existing handlers. So probably better to edit sensu_handler json provider? Thoughts? |
Hi @somic thanks for this. I tried the first suggested fix but I get The second fix works fine however, I've fixed that in my fork and I'll continue to use that until it gets fixed in master. Thanks again! |
change default for filters param of sensu::handler (fix #374)
Hi,
I'm pretty new to sensu and the sensu puppet module and I'm not sure if I've hit a bug or I have my configuration wrong.
I have a filter defined as follows:
This creates what appears to be a valid sensu config json file. However when I alter a handler to use this filter with the following config:
A puppet run throws the following errors:
The text was updated successfully, but these errors were encountered: