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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef6d260f3a69448e3a303ce08ce763250d7b7d19
4
- data.tar.gz: 014d25fbb63da7810ca2ad80172d9712e6912906
3
+ metadata.gz: be148ef059d6a70cb141803bbddbb0057d04c0b2
4
+ data.tar.gz: 2ddb52d10346ec77e5b619ca0eb062b2d09faffc
5
5
  SHA512:
6
- metadata.gz: 500751d2e63b018ae29ac8d93fc1dfe2452df2175271a48e50a98c65eb2d236fe1a0946aa79520f17b1780bd18e6da3eb664e8a894562c5928ec68a986026961
7
- data.tar.gz: 57bc19aa368477c6dd317538fdefb12ad67ab4818bb7cd7832e838c46e2f0f35356e8b913474b8b83ac9edb5211b3f3eaf1608bb68ea5f38b309b6dc34325b8d
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "sensu-settings"
5
- spec.version = "1.0.0"
5
+ spec.version = "1.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"
@@ -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.0.0
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-06-13 00:00:00.000000000 Z
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.0
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: