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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1fdb6232d33121ec1fedbb3f3c8426371a89111b
4
- data.tar.gz: 9b9d6896325f9f58982b25995d781cdcf5200fc8
3
+ metadata.gz: 1a4f1a3ec54f01cdcbc1695ae3ea50bd3f729e45
4
+ data.tar.gz: 38ab52e28a371d5466c4275e24b9027dd9b35eb3
5
5
  SHA512:
6
- metadata.gz: 772d0f3421965e774bd7f2c33e56e081de4e1ba2592bbb7e8b4aad45b3d0601378b38cb76ae09148b3e7c6599d78efa58025113a2c9e925493d16c7487a86031
7
- data.tar.gz: 501534272b7fc5c0a0c70634e1f6fdac842931fb4198b35cee587b120c61bd1d45b76e1ec59692af215f6bca5efd35dc58fb084b74ebbc370e6efcb2300aa82d
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
- must_be_a_string_if_set(transport[:name]) ||
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "sensu-settings"
5
- spec.version = "1.7.0"
5
+ spec.version = "1.8.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"
@@ -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(0)
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.7.0
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-04-28 00:00:00.000000000 Z
11
+ date: 2015-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json