lib/flapjack/data/notification.rb in flapjack-0.8.8 vs lib/flapjack/data/notification.rb in flapjack-0.8.9

- old
+ new

@@ -141,17 +141,19 @@ media else # matchers are rules of the contact that have matched the current event # for time, entity and tags matchers = rules.select do |rule| - logger.debug("considering rule with entities: #{rule.entities} and tags: #{rule.tags.to_json}") - rule_has_tags = rule.tags ? (rule.tags.length > 0) : false - rule_has_entities = rule.entities ? (rule.entities.length > 0) : false + logger.debug("considering rule with entities: #{rule.entities}, tags: #{rule.tags.to_json} and regex tags: #{rule.regex_tags.to_json}") + rule_has_tags = rule.tags ? (rule.tags.length > 0) : false + rule_has_regex_tags = rule.regex_tags ? (rule.regex_tags.length > 0) : false + rule_has_entities = rule.entities ? (rule.entities.length > 0) : false - matches_tags = rule_has_tags ? rule.match_tags?(@tags) : true - matches_entity = rule_has_entities ? rule.match_entity?(@event_id) : true + matches_tags = rule_has_tags ? rule.match_tags?(@tags) : true + matches_regex_tags = rule_has_regex_tags ? rule.match_regex_tags?(@tags) : true + matches_entity = rule_has_entities ? rule.match_entity?(@event_id) : true - ((matches_entity && matches_tags) || ! rule.is_specific?) && + ((matches_entity && matches_tags && matches_regex_tags) || ! rule.is_specific?) && rule_occurring_now?(rule, :contact => contact, :default_timezone => default_timezone) end logger.debug "#{matchers.length} matchers remain for this contact after time, entity and tags are matched:" matchers.each do |matcher|