sensu-settings 10.9.0 → 10.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sensu/settings/loader.rb +6 -0
- data/lib/sensu/settings/validators/sensu.rb +47 -1
- 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: c688fbfc882c64607771f71795541be631861b36
|
4
|
+
data.tar.gz: 15afa27b366876286f908d834c1932ad98b4aa0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63b496deafec5a6d57e559270a9affd8d60f4c34dd75e8122e797a3f32b4e2a44f769d509685710f53abebd7660f95d327803bdee1c006d312909a46243d3127
|
7
|
+
data.tar.gz: 92efda1105c102520f847708a10dcb37c244254a9774f85d5ccfb23f4669cc2c792fea521165c8a845c1684b82d6fa89ee3744973fd26f81e7184d0f9f2d9eaa
|
@@ -20,13 +20,59 @@ module Sensu
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
# Validate Sensu keepalives thresholds.
|
24
|
+
# Validates: warning, critical
|
25
|
+
#
|
26
|
+
# @param sensu [Hash] sensu definition.
|
27
|
+
def validate_sensu_keepalives_thresholds(sensu)
|
28
|
+
thresholds = sensu[:keepalives][:thresholds]
|
29
|
+
must_be_a_hash_if_set(thresholds) ||
|
30
|
+
invalid(sensu, "sensu keepalives thresholds must be a hash")
|
31
|
+
if is_a_hash?(thresholds)
|
32
|
+
must_be_an_integer_if_set(thresholds[:warning]) ||
|
33
|
+
invalid(sensu, "sensu keepalives warning threshold must be an integer")
|
34
|
+
must_be_an_integer_if_set(thresholds[:critical]) ||
|
35
|
+
invalid(sensu, "sensu keepalives critical threshold must be an integer")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Validate Sensu keepalives handlers.
|
40
|
+
# Validates: handler, handlers
|
41
|
+
#
|
42
|
+
# @param sensu [Hash] sensu definition.
|
43
|
+
def validate_sensu_keepalives_handlers(sensu)
|
44
|
+
must_be_a_string_if_set(sensu[:keepalives][:handler]) ||
|
45
|
+
invalid(sensu, "sensu keepalives handler must be a string")
|
46
|
+
must_be_an_array_if_set(sensu[:keepalives][:handlers]) ||
|
47
|
+
invalid(sensu, "sensu keepalives handlers must be an array")
|
48
|
+
if is_an_array?(sensu[:keepalives][:handlers])
|
49
|
+
items_must_be_strings(sensu[:keepalives][:handlers]) ||
|
50
|
+
invalid(sensu, "sensu keepalives handlers must each be a string")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
# Validate Sensu keepalives.
|
56
|
+
# Validates: thresholds (warning, critical), handler, handlers
|
57
|
+
#
|
58
|
+
# @param sensu [Hash] sensu definition.
|
59
|
+
def validate_sensu_keepalives(sensu)
|
60
|
+
if is_a_hash?(sensu[:keepalives])
|
61
|
+
validate_sensu_keepalives_thresholds(sensu)
|
62
|
+
validate_sensu_keepalives_handlers(sensu)
|
63
|
+
else
|
64
|
+
invalid(sensu, "sensu keepalives must be a hash")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
23
68
|
# Validate a Sensu definition.
|
24
|
-
# Validates: spawn
|
69
|
+
# Validates: spawn, keepalives
|
25
70
|
#
|
26
71
|
# @param sensu [Hash] sensu definition.
|
27
72
|
def validate_sensu(sensu)
|
28
73
|
if is_a_hash?(sensu)
|
29
74
|
validate_sensu_spawn(sensu)
|
75
|
+
validate_sensu_keepalives(sensu)
|
30
76
|
else
|
31
77
|
invalid(sensu, "sensu must be a hash")
|
32
78
|
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.10.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-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-json
|