Small, mostly cosmetic updates and fixing a test.

- The test needed to append the second notice the event queue so that
  the notice would be suppressed correctly.

- Setting $suppress_for manually in apply_policy since it doesn't pick
  up the &default when directly creating the record inside the NOTICE call.
This commit is contained in:
Seth Hall 2011-09-12 15:08:25 -04:00
parent a267c30fcd
commit e0af4f6e8d
3 changed files with 25 additions and 8 deletions

View file

@ -358,12 +358,12 @@ event notice(n: Notice::Info) &priority=-5
Log::write(Notice::LOG, n);
if ( ACTION_ALARM in n$actions )
Log::write(Notice::ALARM_LOG, n);
# Normally suppress further notices like this one unless directed not to
# .
# n$identifier *must* be specified for suppression to function at all.
if ( n?$identifier && ACTION_NO_SUPPRESS !in n$actions &&
[n$note, n$identifier] !in suppressing &&
n$suppress_for != 0secs )
# Normally suppress further notices like this one unless directed not to.
# n$identifier *must* be specified for suppression to function at all.
if ( n?$identifier &&
ACTION_NO_SUPPRESS !in n$actions &&
[n$note, n$identifier] !in suppressing &&
n$suppress_for != 0secs )
{
suppressing[n$note, n$identifier] = n;
event Notice::begin_suppression(n);
@ -446,6 +446,9 @@ function apply_policy(n: Notice::Info)
if ( ! n?$policy_items )
n$policy_items = set();
if ( ! n?$suppress_for )
n$suppress_for = default_suppression_interval;
for ( i in ordered_policy )
{
if ( ordered_policy[i]$pred(n) )