aboutsummaryrefslogtreecommitdiff
path: root/jobs
diff options
context:
space:
mode:
authorTom Ritter <tom@ritter.vg>2017-03-03 14:50:31 -0600
committerTom Ritter <tom@ritter.vg>2017-03-03 14:50:31 -0600
commit129b2869e2da66c3cc2b34e3fc1a0663283a44c7 (patch)
tree24b5be5a26bc3636532c1b1af9451137ebdcc912 /jobs
parentfe136533e9fcd25d1ad9b254e807b116fe4e2615 (diff)
Hopefully finally solve the bug about only getting success messages for state change alerts
Diffstat (limited to 'jobs')
-rwxr-xr-xjobs/JobBase.py8
1 files changed, 6 insertions, 2 deletions
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"""