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 +4 -4
- data/README.md +1 -0
- data/lib/sensu/settings/validators/check.rb +31 -0
- data/sensu-settings.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c5b2454c21bd8dac94282bf6ab6daf6a2c7589d
|
4
|
+
data.tar.gz: f0f516937a784b9c2b644b02d4a8616d0c89ba87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/sensu-settings.gemspec
CHANGED
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.
|
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-
|
11
|
+
date: 2017-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-json
|