sensu-settings 1.7.0 → 1.8.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 +17 -6
- data/lib/sensu/settings/validators/transport.rb +3 -1
- data/sensu-settings.gemspec +1 -1
- data/spec/validator_spec.rb +7 -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: 1a4f1a3ec54f01cdcbc1695ae3ea50bd3f729e45
|
4
|
+
data.tar.gz: 38ab52e28a371d5466c4275e24b9027dd9b35eb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccf5e6b166eb86f7e505c49838fd537468ead0a1573d0725490fa93e84aa265b4d124a167b057148dbed4e0ef027abe47f24e146b14b7c153d1d29b40e249d09
|
7
|
+
data.tar.gz: 9c8bcdbc0271df0ba12684bc7323c082030398eef0e6a2cb15297cb8b2f22dcda87b879edd29862575d29e6c9729bf7fe3c21d5d55955bd233ce9cb8e3e174ed
|
@@ -14,17 +14,28 @@ module Sensu
|
|
14
14
|
|
15
15
|
def initialize
|
16
16
|
@warnings = []
|
17
|
-
@settings =
|
18
|
-
:transport => {}
|
19
|
-
}
|
20
|
-
CATEGORIES.each do |category|
|
21
|
-
@settings[category] = {}
|
22
|
-
end
|
17
|
+
@settings = default_settings
|
23
18
|
@indifferent_access = false
|
24
19
|
@loaded_files = []
|
25
20
|
self.class.create_category_methods
|
26
21
|
end
|
27
22
|
|
23
|
+
# Default settings.
|
24
|
+
#
|
25
|
+
# @return [Hash] settings.
|
26
|
+
def default_settings
|
27
|
+
default = {
|
28
|
+
:transport => {
|
29
|
+
:name => "rabbitmq",
|
30
|
+
:reconnect_on_error => true
|
31
|
+
}
|
32
|
+
}
|
33
|
+
CATEGORIES.each do |category|
|
34
|
+
default[category] = {}
|
35
|
+
end
|
36
|
+
default
|
37
|
+
end
|
38
|
+
|
28
39
|
# Create setting category accessors and methods to test the
|
29
40
|
# existence of definitions. Called in initialize().
|
30
41
|
def self.create_category_methods
|
@@ -8,8 +8,10 @@ module Sensu
|
|
8
8
|
# @param transport [Hash] sensu transport definition.
|
9
9
|
def validate_transport(transport)
|
10
10
|
if is_a_hash?(transport)
|
11
|
-
|
11
|
+
must_be_a_string(transport[:name]) ||
|
12
12
|
invalid(transport, "transport name must be a string")
|
13
|
+
must_be_boolean_if_set(transport[:reconnect_on_error]) ||
|
14
|
+
invalid(transport, "transport reconnect_on_error must be boolean")
|
13
15
|
else
|
14
16
|
invalid(transport, "transport must be a hash")
|
15
17
|
end
|
data/sensu-settings.gemspec
CHANGED
data/spec/validator_spec.rb
CHANGED
@@ -30,13 +30,19 @@ describe "Sensu::Settings::Validator" do
|
|
30
30
|
expect(@validator.reset).to eq(1)
|
31
31
|
transport = {}
|
32
32
|
@validator.validate_transport(transport)
|
33
|
-
expect(@validator.reset).to eq(
|
33
|
+
expect(@validator.reset).to eq(1)
|
34
34
|
transport[:name] = 1
|
35
35
|
@validator.validate_transport(transport)
|
36
36
|
expect(@validator.reset).to eq(1)
|
37
37
|
transport[:name] = "rabbitmq"
|
38
38
|
@validator.validate_transport(transport)
|
39
39
|
expect(@validator.reset).to eq(0)
|
40
|
+
transport[:reconnect_on_error] = "invalid"
|
41
|
+
@validator.validate_transport(transport)
|
42
|
+
expect(@validator.reset).to eq(1)
|
43
|
+
transport[:reconnect_on_error] = false
|
44
|
+
@validator.validate_transport(transport)
|
45
|
+
expect(@validator.reset).to eq(0)
|
40
46
|
end
|
41
47
|
|
42
48
|
it "can run, validating transport" do
|
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: 1.
|
4
|
+
version: 1.8.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: 2015-
|
11
|
+
date: 2015-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|