sensu-settings 1.0.0 → 1.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/check.rb +14 -0
- data/sensu-settings.gemspec +1 -1
- data/spec/validator_spec.rb +9 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be148ef059d6a70cb141803bbddbb0057d04c0b2
|
4
|
+
data.tar.gz: 2ddb52d10346ec77e5b619ca0eb062b2d09faffc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a890ec24f4140fa1442684bbf369c1e49d34a2652a18f3f51b0132b74ca1bf9ea58219c4774fa891fbcd13866fbb2f7be26d59608b0d47d449df42b8134a9ba3
|
7
|
+
data.tar.gz: 8c87459191c206e6da49b448e3ba44ed38dbededc48edeb7516c12782cfd4c7fd8828773940ca381fe5b7df1642802b06eb266bf465bed20bfe5138230cf1096
|
@@ -53,6 +53,17 @@ module Sensu
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
+
# Validate check masquerade.
|
57
|
+
# Validates: masquerade
|
58
|
+
#
|
59
|
+
# @param check [Hash] sensu check definition.
|
60
|
+
def validate_check_masquerade(check)
|
61
|
+
must_be_a_string(check[:masquerade]) ||
|
62
|
+
invalid(check, "check masquerade must be a string")
|
63
|
+
must_match_regex(/^[\w\.-]+$/, check[:masquerade]) ||
|
64
|
+
invalid(check, "check masquerade cannot contain spaces or special characters")
|
65
|
+
end
|
66
|
+
|
56
67
|
# Validate a Sensu check definition.
|
57
68
|
#
|
58
69
|
# @param check [Hash] sensu check definition.
|
@@ -68,6 +79,9 @@ module Sensu
|
|
68
79
|
validate_check_scheduling(check)
|
69
80
|
validate_check_handling(check)
|
70
81
|
validate_check_flap_detection(check)
|
82
|
+
if check[:masquerade]
|
83
|
+
validate_check_masquerade(check)
|
84
|
+
end
|
71
85
|
if check[:subdue]
|
72
86
|
validate_subdue(check)
|
73
87
|
end
|
data/sensu-settings.gemspec
CHANGED
data/spec/validator_spec.rb
CHANGED
@@ -141,6 +141,15 @@ describe "Sensu::Settings::Validator" do
|
|
141
141
|
check[:high_flap_threshold] = 55
|
142
142
|
@validator.validate_check(check)
|
143
143
|
expect(@validator.reset).to eq(0)
|
144
|
+
check[:masquerade] = 1
|
145
|
+
@validator.validate_check(check)
|
146
|
+
expect(@validator.reset).to eq(2)
|
147
|
+
check[:masquerade] = "%&@*"
|
148
|
+
@validator.validate_check(check)
|
149
|
+
expect(@validator.reset).to eq(1)
|
150
|
+
check[:masquerade] = "i-424242"
|
151
|
+
@validator.validate_check(check)
|
152
|
+
expect(@validator.reset).to eq(0)
|
144
153
|
end
|
145
154
|
|
146
155
|
it "can validate check subdue" 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.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: 2014-
|
11
|
+
date: 2014-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
138
|
version: '0'
|
139
139
|
requirements: []
|
140
140
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.2.
|
141
|
+
rubygems_version: 2.2.2
|
142
142
|
signing_key:
|
143
143
|
specification_version: 4
|
144
144
|
summary: The Sensu settings library, loader and validator
|
@@ -153,3 +153,4 @@ test_files:
|
|
153
153
|
- spec/rules_spec.rb
|
154
154
|
- spec/settings_spec.rb
|
155
155
|
- spec/validator_spec.rb
|
156
|
+
has_rdoc:
|