Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

check "source", no longer going to support "masquerade" #2

Merged
merged 1 commit into from
Sep 24, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions lib/sensu/settings/validators/check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,6 @@ def validate_check_flap_detection(check)
end
end

# Validate check masquerade.
# Validates: masquerade
#
# @param check [Hash] sensu check definition.
def validate_check_masquerade(check)
must_be_a_string(check[:masquerade]) ||
invalid(check, "check masquerade must be a string")
must_match_regex(/^[\w\.-]+$/, check[:masquerade]) ||
invalid(check, "check masquerade cannot contain spaces or special characters")
end

# Validate a Sensu check definition.
#
# @param check [Hash] sensu check definition.
Expand All @@ -76,12 +65,11 @@ def validate_check(check)
invalid(check, "check command must be a string")
must_be_a_numeric_if_set(check[:timeout]) ||
invalid(check, "check timeout must be numeric")
must_be_a_string_if_set(check[:source]) ||
invalid(check, "check source must be a string")
validate_check_scheduling(check)
validate_check_handling(check)
validate_check_flap_detection(check)
if check[:masquerade]
validate_check_masquerade(check)
end
if check[:subdue]
validate_subdue(check)
end
Expand Down
7 changes: 2 additions & 5 deletions spec/validator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,10 @@
check[:high_flap_threshold] = 55
@validator.validate_check(check)
expect(@validator.reset).to eq(0)
check[:masquerade] = 1
@validator.validate_check(check)
expect(@validator.reset).to eq(2)
check[:masquerade] = "%&@*"
check[:source] = 1
@validator.validate_check(check)
expect(@validator.reset).to eq(1)
check[:masquerade] = "i-424242"
check[:source] = "switch-%42%"
@validator.validate_check(check)
expect(@validator.reset).to eq(0)
end
Expand Down