threshold: fix statistics empty case
If no statistics are return, it's then impossible to log the last result. Accessing this provokes an IndexError. Change-Id: I6929d3e4b1549b941df434ca708a5c839edb8d77 Closes-Bug: #1539069
This commit is contained in:
parent
5a2acf7930
commit
dea148d2e3
@ -131,7 +131,7 @@ class ThresholdEvaluator(evaluator.Evaluator):
|
||||
"""Fabricate reason string."""
|
||||
count = len(statistics)
|
||||
disposition = 'inside' if state == evaluator.OK else 'outside'
|
||||
last = statistics[-1]
|
||||
last = statistics[-1] if count else None
|
||||
transition = alarm.state != state
|
||||
reason_data = cls._reason_data(disposition, count, last)
|
||||
if transition:
|
||||
|
Loading…
x
Reference in New Issue
Block a user