sensu-settings 9.9.0 → 9.10.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: ad6aa38a2670cc323faf4d9c9e44cf378808181c
4
- data.tar.gz: b1329ce300073a6efee7bc5f2a9eed8a495db24b
3
+ metadata.gz: 4130a5c9f9c7f870dade98007e89537935948eaa
4
+ data.tar.gz: aa739d99b17cccabfd6acbef823e750cf80ff2f0
5
5
  SHA512:
6
- metadata.gz: 4933d28d1f7319626868f186e3d796cebb3e6b3510154ddb717ddfada7c188bf26124d8c8541a9482876c15703f7a280869996aa82b2616010163b490ac933e9
7
- data.tar.gz: 2122cf394f8eb98b23376586c801e4b0248a636c7a0bd2e2b17f2983c780a960fd6a72ac650992a03aef81cefb438a73931ff3ed3baee4c7a8f6149ea83a6c57
6
+ metadata.gz: f48976092495a8ff65573e8e6ce643a43dee64bdc34fc4975167715027a023dfe6fdff5ffff23382a9383905302ade85d274f475b8899ec3b98b34c86b34d21f
7
+ data.tar.gz: ed2ab15c91f45f7b2a62c0ca418937fdf8f037169cfc0888ccc198548add6bd80b20b006c28d2abe7dc0c09491bf403ec6eb85b91f3c525cb1dda13db4da5e3b
@@ -353,7 +353,7 @@ module Sensu
353
353
  else
354
354
  contents.sub!(/^\357\273\277/, "")
355
355
  end
356
- contents
356
+ contents.strip
357
357
  end
358
358
 
359
359
  # Deep merge two hashes.
@@ -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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "sensu-settings"
5
- spec.version = "9.9.0"
5
+ spec.version = "9.10.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"
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.9.0
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-02-20 00:00:00.000000000 Z
11
+ date: 2017-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-json