From 4e8445b864f4ca113cab8a15527db56079edfc34 Mon Sep 17 00:00:00 2001 From: arbulu89 Date: Wed, 27 Apr 2022 16:21:41 +0200 Subject: [PATCH 1/3] Disable check result overwritting --- runner/ansible/callback_plugins/trento.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/runner/ansible/callback_plugins/trento.py b/runner/ansible/callback_plugins/trento.py index 27112fe..e9cde61 100644 --- a/runner/ansible/callback_plugins/trento.py +++ b/runner/ansible/callback_plugins/trento.py @@ -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)) From 3f925d262a6e4a0592134da509025b0190934c64 Mon Sep 17 00:00:00 2001 From: arbulu89 Date: Wed, 27 Apr 2022 16:29:17 +0200 Subject: [PATCH 2/3] Set abnormally failed tasks to critical --- runner/ansible/callback_plugins/trento.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runner/ansible/callback_plugins/trento.py b/runner/ansible/callback_plugins/trento.py index e9cde61..b9953b3 100644 --- a/runner/ansible/callback_plugins/trento.py +++ b/runner/ansible/callback_plugins/trento.py @@ -243,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): """ From 81c28ab7d4ca829a98cbcd9b4286f0f7a1d2f903 Mon Sep 17 00:00:00 2001 From: arbulu89 Date: Wed, 27 Apr 2022 16:57:42 +0200 Subject: [PATCH 3/3] Update python binary path in Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d37c289..441a34f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ ADD . /build RUN zypper -n in git-core && make build FROM registry.suse.com/bci/python:3.9 AS trento-runner -RUN /usr/bin/python3 -m venv /venv \ +RUN /usr/local/bin/python3 -m venv /venv \ && /venv/bin/pip install 'ansible~=4.6.0' 'requests~=2.26.0' 'rpm==0.0.2' 'pyparsing~=2.0' \ && zypper -n ref && zypper -n in --no-recommends openssh \ && zypper -n clean