sensu-settings 9.9.0 → 9.10.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/lib/sensu/settings/loader.rb +1 -1
- data/lib/sensu/settings/validators/api.rb +29 -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: 4130a5c9f9c7f870dade98007e89537935948eaa
|
4
|
+
data.tar.gz: aa739d99b17cccabfd6acbef823e750cf80ff2f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f48976092495a8ff65573e8e6ce643a43dee64bdc34fc4975167715027a023dfe6fdff5ffff23382a9383905302ade85d274f475b8899ec3b98b34c86b34d21f
|
7
|
+
data.tar.gz: ed2ab15c91f45f7b2a62c0ca418937fdf8f037169cfc0888ccc198548add6bd80b20b006c28d2abe7dc0c09491bf403ec6eb85b91f3c525cb1dda13db4da5e3b
|
@@ -15,6 +15,34 @@ module Sensu
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
+
# Validate API endpoints.
|
19
|
+
# Validates: endpoints
|
20
|
+
#
|
21
|
+
# @param api [Hash] sensu api definition.
|
22
|
+
def validate_api_endpoints(api)
|
23
|
+
if is_an_array?(api[:endpoints])
|
24
|
+
api[:endpoints].each do |endpoint|
|
25
|
+
if is_a_hash?(endpoint)
|
26
|
+
if endpoint[:url]
|
27
|
+
must_be_a_string(endpoint[:url]) ||
|
28
|
+
invalid(api, "api endpoint url must be a string")
|
29
|
+
else
|
30
|
+
must_be_a_string(endpoint[:host]) ||
|
31
|
+
invalid(api, "api endpoint host must be a string")
|
32
|
+
must_be_an_integer(endpoint[:port]) ||
|
33
|
+
invalid(api, "api endpoint port must be an integer")
|
34
|
+
must_be_boolean_if_set(endpoint[:ssl]) ||
|
35
|
+
invalid(api, "api endpoint ssl must be a boolean")
|
36
|
+
end
|
37
|
+
else
|
38
|
+
invalid(api, "api endpoints must each be a hash")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
else
|
42
|
+
invalid(api, "api endpoints must be an array")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
18
46
|
# Validate a Sensu API definition.
|
19
47
|
# Validates: port, bind
|
20
48
|
#
|
@@ -28,6 +56,7 @@ module Sensu
|
|
28
56
|
must_be_a_string_if_set(api[:bind]) ||
|
29
57
|
invalid(api, "api bind must be a string")
|
30
58
|
validate_api_authentication(api)
|
59
|
+
validate_api_endpoints(api) if api[:endpoints]
|
31
60
|
end
|
32
61
|
end
|
33
62
|
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: 9.
|
4
|
+
version: 9.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-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-json
|