sensu-plugins / sensu-plugins-mailer

This plugin is an email handler for Sensu.
http://sensu-plugins.io
MIT License
17 stars 37 forks source link

Feature/unknown on passing contacts to contact #59

Closed majormoses closed 6 years ago

majormoses commented 6 years ago

Pull Request Checklist

58

General

Purpose

Provide user with better feedback when improperly using contact rather than contacts when passing multiple contacts.

Known Compatibility Issues

Anyone who is using it currently incorrectly will have start alerting them to their misconfiguration. I feel the benefit outweighs the negative as it informs them exactly what needs to change and if they pull in a major version without reading the changelog that is on them.

majormoses commented 6 years ago

ping @eheydrick

eheydrick commented 6 years ago

lolwoops missed this. LGTM. Does exit 3 in a handler do anything special?

eheydrick commented 6 years ago

Release away.

majormoses commented 6 years ago

@eheydrick an unknown is essentially printing a message and exiting with 3: https://github.com/sensu-plugins/sensu-plugin/blob/v2.1.0/lib/sensu-plugin.rb#L8 and https://github.com/sensu-plugins/sensu-plugin/blob/v2.1.0/lib/sensu-plugin/cli.rb#L23-L32 I just did not feel like doing another include for some reason.

eheydrick commented 6 years ago

Right, I was uncertain if sensu-handler does the same exit code printing stuff as sensu-plugin does in regular checks. I think you'll see the message in the server log.

majormoses commented 6 years ago

ya I would just need to include the sensu cli into the handler and it seemed easier to just have the same end result. I wonder if we should auto include cli into handler class., do you know if there was any reason we don't?

eheydrick commented 6 years ago

i think it's fine as is. handlers don't really run on the cli and you never see the log output except if you're looking for it in the server log.

majormoses commented 6 years ago

released: https://rubygems.org/gems/sensu-plugins-mailer/versions/2.0.0