sensu-settings 4.0.0 → 4.1.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: 25d64e131590e9ad8c0422ffac256c7d58b96534
4
- data.tar.gz: f8e4095b4f3697d0684387bc8d5d25d2f92451cf
3
+ metadata.gz: 08c4f5939688872fc9cfb94e3a4c42af084318c1
4
+ data.tar.gz: 01b6875531d8db73bc2b835e74a731916be74ae6
5
5
  SHA512:
6
- metadata.gz: b0c560de6157c8454bc3b640460fe8edf408c1b188f416d99784e1f0b013713bb6527b76cc17edd4448c9e05d311a928b7ac21e9e51c572a5b834b3d9b0e3c81
7
- data.tar.gz: 180058d0339579b553fd5ae8aa9d4ff82cfc49106afaf7ebd01c571fc69ff6a321ab206adc38ad07f2231ecd5785c919ccad6f0becab9d99c4c5d976c3156fc0
6
+ metadata.gz: 6e73354ccda29c9748589e941b279ac971c12f53826eff5c4e264016f4f4b968e0f0719a1ed3e525f68074547ee7ac18f878d99991d1a5451fbffcca47ee1d6f
7
+ data.tar.gz: 75f9b0d366c0661f22ada4012082931bf8abd7321dcd0df81cc33eec835984c253cce2c8471f5b820b414e52441fb736bc7a6ac027d0db431c4629204a3f2cad
@@ -39,6 +39,15 @@ module Sensu
39
39
  end
40
40
  end
41
41
 
42
+ # Validate client keepalives.
43
+ # Validates: keepalives
44
+ #
45
+ # @param client [Hash] sensu client definition.
46
+ def validate_client_keepalives(client)
47
+ must_be_boolean_if_set(client[:keepalives]) ||
48
+ invalid(client, "client keepalives must be boolean")
49
+ end
50
+
42
51
  # Validate client keepalive handlers.
43
52
  # Validates: keepalive (handler, handlers)
44
53
  #
@@ -149,6 +158,7 @@ module Sensu
149
158
  validate_client_safe_mode(client)
150
159
  validate_client_subscriptions(client)
151
160
  validate_client_socket(client)
161
+ validate_client_keepalives(client)
152
162
  validate_client_keepalive(client)
153
163
  validate_client_redact(client)
154
164
  validate_client_signature(client)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "sensu-settings"
5
- spec.version = "4.0.0"
5
+ spec.version = "4.1.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"
@@ -555,6 +555,28 @@ describe "Sensu::Settings::Validator" do
555
555
  expect(@validator.reset).to eq(0)
556
556
  end
557
557
 
558
+ it "can validate client keepalives" do
559
+ client = {
560
+ :name => "foo",
561
+ :address => "127.0.0.1",
562
+ :subscriptions => ["bar"]
563
+ }
564
+ @validator.validate_client(client)
565
+ expect(@validator.reset).to eq(0)
566
+ client[:keepalives] = 1
567
+ @validator.validate_client(client)
568
+ expect(@validator.reset).to eq(1)
569
+ client[:keepalives] = "true"
570
+ @validator.validate_client(client)
571
+ expect(@validator.reset).to eq(1)
572
+ client[:keepalives] = true
573
+ @validator.validate_client(client)
574
+ expect(@validator.reset).to eq(0)
575
+ client[:keepalives] = false
576
+ @validator.validate_client(client)
577
+ expect(@validator.reset).to eq(0)
578
+ end
579
+
558
580
  it "can validate client keepalive" do
559
581
  client = {
560
582
  :name => "foo",
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: 4.0.0
4
+ version: 4.1.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: 2016-05-03 00:00:00.000000000 Z
11
+ date: 2016-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-json