skip on empty dict

This commit is contained in:
wh1te909 2022-04-09 23:09:21 +00:00
parent 27d537e7bb
commit 24a17712e7
1 changed files with 3 additions and 2 deletions

View File

@ -291,8 +291,9 @@ def clear_faults_task(older_than_days: int) -> None:
for agent in agents:
for check in agent.get_checks_with_policies():
# reset check status
check.check_result.status = "passing"
check.check_result.save(update_fields=["status"])
if check.check_result:
check.check_result.status = "passing"
check.check_result.save(update_fields=["status"])
if check.alert.filter(agent=agent, resolved=False).exists():
alert = Alert.create_or_return_check_alert(check, agent=agent)
if alert: