sensu-settings 10.3.0 → 10.4.0

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
  SHA1:
3
- metadata.gz: df9c1ef226d6f1b790459970331430e6fc740b07
4
- data.tar.gz: 58f9d03a7de2bff8d766a7e4109c2bb2ecbd11c3
3
+ metadata.gz: 6c5b2454c21bd8dac94282bf6ab6daf6a2c7589d
4
+ data.tar.gz: f0f516937a784b9c2b644b02d4a8616d0c89ba87
5
5
  SHA512:
6
- metadata.gz: e5b87f47d462f87fdd37bf35d80d868f19d015dd6f222c41cb78e7aba31120d822362d17d6887809b61b25c9dba78ef687d21a9259a91cc50312d33fe59da63b
7
- data.tar.gz: 63f704d725f0903a215716fb5867794d76a423b91a6fc6946badb8fa352638e1d7f716e4610cf09a8a38d0d26e6e20940badb2521d42238190f25d4fbe919967
6
+ metadata.gz: 68fcba68d86d49c144a284742f908e2011fb3064ef7a7606928dff8366b20e47f126732da568120d8f9753a8c4233fb9ddd88bb969db52ed23c15a1dcbdd4cc8
7
+ data.tar.gz: a2ead53a65aab124f700daf30f2db13424f908f1cff983f41cb369c5f0f0449ca568f87da1225d383e4740f62b624d3a003b59c4db43274131fa31216e958b9b
data/README.md CHANGED
@@ -20,6 +20,7 @@ Documentation can be found [here](http://rubydoc.info/github/sensu/sensu-setting
20
20
 
21
21
  ## Contributing
22
22
 
23
+ 0. By contributing to this project you agree to abide by the [code of conduct](https://sensuapp.org/conduct).
23
24
  1. [Fork it](https://github.com/sensu/sensu-settings/fork)
24
25
  2. Create your feature branch (`git checkout -b my-new-feature`)
25
26
  3. Commit your changes (`git commit -am 'Add some feature'`)
@@ -165,6 +165,36 @@ module Sensu
165
165
  end
166
166
  end
167
167
 
168
+ # Validate check hook execution.
169
+ # Validates: command, timeout
170
+ #
171
+ # @param check [Hash] sensu check definition.
172
+ # @param hook [Hash] sensu check hook definition.
173
+ def validate_check_hook_execution(check, hook)
174
+ must_be_a_string(hook[:command]) ||
175
+ invalid(check, "check hook command must be a string")
176
+ must_be_a_numeric_if_set(hook[:timeout]) ||
177
+ invalid(check, "check hook timeout must be numeric")
178
+ end
179
+
180
+ # Validate check hooks.
181
+ # Validates: hooks
182
+ #
183
+ # @param check [Hash] sensu check definition.
184
+ def validate_check_hooks(check)
185
+ if check[:hooks].is_a?(Hash)
186
+ check[:hooks].each do |key, hook|
187
+ must_be_either(%w[ok warning critical unknown], key.to_s) ||
188
+ (0..255).map {|i| i.to_s}.include?(key.to_s) ||
189
+ key.to_s == "non-zero" ||
190
+ invalid(check, "check hook key must be a severity, status, or 'non-zero'")
191
+ validate_check_hook_execution(check, hook)
192
+ end
193
+ else
194
+ invalid(check, "check hooks must be a hash")
195
+ end
196
+ end
197
+
168
198
  # Validate check subdue.
169
199
  # Validates: subdue
170
200
  #
@@ -186,6 +216,7 @@ module Sensu
186
216
  validate_check_ttl(check) if check[:ttl]
187
217
  validate_check_aggregate(check)
188
218
  validate_check_flap_detection(check)
219
+ validate_check_hooks(check) if check[:hooks]
189
220
  validate_check_subdue(check) if check[:subdue]
190
221
  end
191
222
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "sensu-settings"
5
- spec.version = "10.3.0"
5
+ spec.version = "10.4.0"
6
6
  spec.authors = ["Sean Porter"]
7
7
  spec.email = ["portertech@gmail.com"]
8
8
  spec.summary = "The Sensu settings library, loader and validator"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-settings
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.3.0
4
+ version: 10.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Porter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-24 00:00:00.000000000 Z
11
+ date: 2017-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-json