Fix issue 160: regression on sensu-handler.rb, introduced with Ruby 1.9.0 compatibility fix in 1.4.3 #161
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes a regression in the sensu-handler.rb, which breaks calls to the sensu API in version 1.4.3.
Description
The regression was caused by a previous commit which fixed a bug in Ruby 1.9 [sensu-handler.rb, line 136: changed 'uri' to 'uri.to_s']. This fix commit simply wraps the
uri =
in anif RUBY_VERSION > 1.9
check before deciding which method to use.Motivation and Context
sensu-plugins 1.4.3 is currently broken on newer Ruby versions.
The issue this fixes is: #160
How Has This Been Tested?
I am running this fork in a test datacenter on 3x sensu servers, and it fixes the regression.
I have not tested this on any older Ruby versions, but it's a simple 'if' statement.
Versions used in test:
Ruby: 2.3.0
Sensu: 0.26.5
sensu-plugin: 1.4.3 (with this patch)
Types of changes
Checklist:
Known Caveats