Add option to output cmd stdout with check-cmd#60
Conversation
|
Thanks for your contribution to Sensu plugins! Without people like you submitting PRs we couldn't run the project. I will review it shortly. |
|
Hmm it looks like rubocop is pointing out that there is quite of bit of nesting conditionals which often leads to buggy code and poor performance. I see a couple ways we can improve this:
|
|
I'd love to rewrite this, but I'm not really a Ruby programmer so I'm not sure if I'd be qualified. |
No worries, I won't try to pressure you into doing something you are uncomfortable with. I consider myself a sysadmin who can write ruby more than a ruby programmer but if I have some time this weekend I will try to work on a re-write ping me next week if I have not replied here. |
|
@majormoses Did you have time to look at this? |
|
@lahdekorpi sorry I did not have the time and thanks for pinging me. Maybe the best thing would be to put inline rubocop disables and a |
| ok "#{config[:command]} exited with #{$CHILD_STATUS.exitstatus}" | ||
| status = "#{config[:command]} exited with #{$CHILD_STATUS.exitstatus}" | ||
| status += "\nOutput: #{stdout}" if config[:echo_stdout] | ||
| status ok |
There was a problem hiding this comment.
btw this looks wrong to me I am guess this is meant to be ok status.
|
@lahdekorpi I finally had the time to sit down with this for a bit (honestly I'd love to find the time to rewrite it entirely) of refactoring. As there are a lack of useful automated tests if you can help with running some tests and sharing the results here it that would be appreciated. |
Purpose
Adds a flag to allow outputting the stdout of the command. Helps with getting status information about a command.