sensu-settings 4.1.0 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/sensu/settings/validators/check.rb +1 -1
- data/lib/sensu/settings/validators/client.rb +1 -1
- data/sensu-settings.gemspec +1 -1
- data/spec/validator_spec.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec4eeffddb4f928ca7f35e4db5d455aa883d7569
|
4
|
+
data.tar.gz: 3dfcc2c5db1020a95919534e3fae558ae9a557a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01aca6eb9d8281cfa44433f6a468ecf7a206fec2bf922171210016884e1fb47a039d7e2a84cff9d4d48fb6dfa29ac118387e326a7e6ae7e9d31b8943fee75081
|
7
|
+
data.tar.gz: b9ec4ea24e44e6079f7c2e99574fbe225b06a5054b853272012b5e80ef25933be5b247f0080dc9585851c816881771868631d5e3f4a5cb75f9f3e49e8b2d279e
|
@@ -9,7 +9,7 @@ module Sensu
|
|
9
9
|
def validate_check_name(check)
|
10
10
|
must_be_a_string(check[:name]) ||
|
11
11
|
invalid(check, "check name must be a string")
|
12
|
-
must_match_regex(
|
12
|
+
must_match_regex(/\A[\w\.-]+\z/, check[:name]) ||
|
13
13
|
invalid(check, "check name cannot contain spaces or special characters")
|
14
14
|
end
|
15
15
|
|
@@ -151,7 +151,7 @@ module Sensu
|
|
151
151
|
if is_a_hash?(client)
|
152
152
|
must_be_a_string(client[:name]) ||
|
153
153
|
invalid(client, "client name must be a string")
|
154
|
-
must_match_regex(
|
154
|
+
must_match_regex(/\A[\w\.-]+\z/, client[:name]) ||
|
155
155
|
invalid(client, "client name cannot contain spaces or special characters")
|
156
156
|
must_be_a_string(client[:address]) ||
|
157
157
|
invalid(client, "client address must be a string")
|
data/sensu-settings.gemspec
CHANGED
data/spec/validator_spec.rb
CHANGED
@@ -74,6 +74,9 @@ describe "Sensu::Settings::Validator" do
|
|
74
74
|
check = {:name => "foo bar"}
|
75
75
|
@validator.validate_check(check)
|
76
76
|
expect(@validator.reset).to eq(4)
|
77
|
+
check[:name] = "foo\nbar"
|
78
|
+
@validator.validate_check(check)
|
79
|
+
expect(@validator.reset).to eq(4)
|
77
80
|
check[:name] = "foo"
|
78
81
|
@validator.validate_check(check)
|
79
82
|
expect(@validator.reset).to eq(3)
|
@@ -480,6 +483,9 @@ describe "Sensu::Settings::Validator" do
|
|
480
483
|
client[:name] = "foo bar"
|
481
484
|
@validator.validate_client(client)
|
482
485
|
expect(@validator.reset).to eq(3)
|
486
|
+
client[:name] = "foo\nbar"
|
487
|
+
@validator.validate_client(client)
|
488
|
+
expect(@validator.reset).to eq(3)
|
483
489
|
client[:name] = "foo"
|
484
490
|
@validator.validate_client(client)
|
485
491
|
expect(@validator.reset).to eq(2)
|