Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set failed check executions as critical #43

Merged
merged 3 commits into from
Apr 27, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions runner/ansible/callback_plugins/trento.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,12 @@ def add_result(self, check_id, result, msg=""):
"""
Add check result
"""
# Check if a result already exists
# Due how ansible callbacks system works, we might get same check results twice
# where the 2nd result is false, as it gives the results of `set_test_result` task
# when the check has failed due abnormal behaviours
for result_item in self.results:
if result_item.check_id == check_id:
result_item.result = result
result_item.msg = msg
break
else:
self.results.append(CheckResult(check_id, result, msg))
Expand Down Expand Up @@ -241,7 +243,7 @@ def v2_runner_on_failed(self, result, ignore_errors):

msg = result._check_key("msg")
self.execution_results.add_host(host, True)
self.execution_results.add_result(host, task_vars[CHECK_ID], "warning", msg)
self.execution_results.add_result(host, task_vars[CHECK_ID], "critical", msg)

def v2_runner_on_skipped(self, result):
"""
Expand Down