sensu-plugins-slack 3.1.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7efce7409ed4fc12c85d25d5b310bd04b4b1b35f2330db8c7cac93643c3af24c
4
- data.tar.gz: 4edac8431ae9543ea983f3c0e2147b374fe304784a358d4a7fcd0ae740134cb7
3
+ metadata.gz: ecab2f4ba5c55e4d5c172623e63fe152bf2dc4174ec4ee96e1abfd61bf18826a
4
+ data.tar.gz: 4b2a25d455aea5fcf91559f8e116dbe23022927cc378936f27aba44a9492cbca
5
5
  SHA512:
6
- metadata.gz: 96af9cca85ebc39233536367fe90d2d8dcb44c969389faa8af01475afad4be170a8bbd9b4767433d5970b3bb6fb6a34113a22d1f62b7d4f2896bcef13400124e
7
- data.tar.gz: 00a0bea5bd7fec2e1e2ffc7244c41d40afcd93052de9a2a4e181b92001018ae7705036757464a94ab6b7d6e4faeb853dc1f9216d05b04b36c87a088581865a55
6
+ metadata.gz: 239b35324f6def0af3b30de9c392be603c1e2bc7528945b70bb9db56897d5be2198d7839a73d7dfece7dacbccc2c0fde50b89ac44fdf1b1e99fa7d367c97c501
7
+ data.tar.gz: cbca86c11a4416df320b1b1f98543c1afde924045d4b74d8818a97f28e09732ab3e5c0d8c4f67f2668b803d9a5ccf95419866a53f28a03e9d7ea1e2c4f98a1e9
@@ -5,6 +5,10 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [3.1.1] - 2018-03-17
9
+ ### Fixed
10
+ - handler-slack.rb: rescue any non sensu specification compliant status code passed to the slack handler as the color matching unknown (@majormoses)
11
+
8
12
  ## [3.1.0] - 2018-01-31
9
13
  ### Changed
10
14
  - `handler-slack.rb`: emit an `unknown` with helpful debug messages when passing in bad config (@majormoses)
@@ -122,7 +126,8 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
122
126
  ### Added
123
127
  - initial release
124
128
 
125
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-slack/compare/3.1.0...HEAD
129
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-slack/compare/3.1.1...HEAD
130
+ [3.1.1]: https://github.com/sensu-plugins/sensu-plugins-slack/compare/3.1.0...3.1.1
126
131
  [3.1.0]: https://github.com/sensu-plugins/sensu-plugins-slack/compare/3.0.0...3.1.0
127
132
  [3.0.0]: https://github.com/sensu-plugins/sensu-plugins-slack/compare/2.0.0...3.0.0
128
133
  [2.0.0]: https://github.com/sensu-plugins/sensu-plugins-slack/compare/1.5.0...2.0.0
@@ -210,7 +210,21 @@ class Slack < Sensu::Handler
210
210
  2 => '#FF0000',
211
211
  3 => '#6600CC'
212
212
  }
213
- color.fetch(check_status.to_i)
213
+ begin
214
+ color.fetch(check_status.to_i)
215
+ # a script can return any error code it feels like we should not assume
216
+ # that it will always be 0,1,2,3 even if that is the sensu (nagions)
217
+ # specification. A couple common examples:
218
+ # 1. A sensu server schedules a check on the instance but the command
219
+ # executed does not exist in your `$PATH`. Shells will return a `127` status
220
+ # code.
221
+ # 2. Similarly a `126` is a permission denied or the command is not
222
+ # executable.
223
+ # Rather than adding every possible value we should just treat any non spec
224
+ # designated status code as `unknown`s.
225
+ rescue KeyError
226
+ color.fetch(3)
227
+ end
214
228
  end
215
229
 
216
230
  def check_status
@@ -224,6 +238,11 @@ class Slack < Sensu::Handler
224
238
  2 => :CRITICAL,
225
239
  3 => :UNKNOWN
226
240
  }
227
- status[check_status.to_i]
241
+ begin
242
+ status.fetch(check_status.to_i)
243
+ # handle any non standard check status as `unknown`
244
+ rescue KeyError
245
+ status.fetch(3)
246
+ end
228
247
  end
229
248
  end
@@ -2,7 +2,7 @@ module SensuPluginsSlack
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 1
5
- PATCH = 0
5
+ PATCH = 1
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-slack
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-01 00:00:00.000000000 Z
11
+ date: 2018-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: erubis
@@ -205,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
205
  version: '0'
206
206
  requirements: []
207
207
  rubyforge_project:
208
- rubygems_version: 2.7.4
208
+ rubygems_version: 2.7.6
209
209
  signing_key:
210
210
  specification_version: 4
211
211
  summary: Sensu plugins for interfacing with Slack chat