diff --git a/lib/sensu/settings/validators/check.rb b/lib/sensu/settings/validators/check.rb index b87f3fa..8ed8a65 100644 --- a/lib/sensu/settings/validators/check.rb +++ b/lib/sensu/settings/validators/check.rb @@ -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. @@ -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 diff --git a/spec/validator_spec.rb b/spec/validator_spec.rb index 84904e2..8d5ad3f 100644 --- a/spec/validator_spec.rb +++ b/spec/validator_spec.rb @@ -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