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 +4 -4
- data/lib/sensu/settings/validators/client.rb +10 -0
- data/sensu-settings.gemspec +1 -1
- data/spec/validator_spec.rb +22 -0
- 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: 08c4f5939688872fc9cfb94e3a4c42af084318c1
|
4
|
+
data.tar.gz: 01b6875531d8db73bc2b835e74a731916be74ae6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
data/sensu-settings.gemspec
CHANGED
data/spec/validator_spec.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2016-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-json
|