From 129b2869e2da66c3cc2b34e3fc1a0663283a44c7 Mon Sep 17 00:00:00 2001 From: Tom Ritter Date: Fri, 3 Mar 2017 14:50:31 -0600 Subject: Hopefully finally solve the bug about only getting success messages for state change alerts --- jobs/JobBase.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'jobs/JobBase.py') diff --git a/jobs/JobBase.py b/jobs/JobBase.py index 7658a37..4ac1f0d 100755 --- a/jobs/JobBase.py +++ b/jobs/JobBase.py @@ -86,8 +86,12 @@ class JobBase(object): return True return False elif notifyFrequency == JobFailureNotificationFrequency.ONSTATECHANGE: - #Only notify if the last JobState was a Success - return jobState.CurrentStateSuccess + if minFailureCount == 1: + # If we notify on the first failure, only notify if the last JobState was a Success + return jobState.CurrentStateSuccess + else: + # If we notify after N failures, only notify if this is exactly the nth failure + return 1 + currentFailureCount == minFailureCount return True """Helper method to send email""" -- cgit v1.2.3