aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2022-01-21 11:08:50 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2022-01-21 14:01:32 +0100
commitdbd654f43b545013f8daacd6b628bb3e2f1abff3 (patch)
tree6a3cbf9023afbc6292ad7f99aa9f66f642af2f73
parent334d4529686f3e06f97c454c40ad20428d1d334b (diff)
Protect if detail is returned as None
It occured when running ansible. Change-Id: I908270fdb76fbc3bdf60787b189cdbc29c41b52b Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit 769898458263b7f138c7ffc9126c376781fa71d4)
-rw-r--r--xtesting/core/ansible.py2
-rw-r--r--xtesting/core/testcase.py2
2 files changed, 3 insertions, 1 deletions
diff --git a/xtesting/core/ansible.py b/xtesting/core/ansible.py
index 7ccace9f..fa7b533c 100644
--- a/xtesting/core/ansible.py
+++ b/xtesting/core/ansible.py
@@ -58,7 +58,7 @@ class Ansible(testcase.TestCase):
kwargs["quiet"] = True
kwargs["artifact_dir"] = self.res_dir
runner = ansible_runner.run(**kwargs)
- self.details = runner.stats
+ self.details = runner.stats or {}
if runner.rc == 0:
self.result = 100
status = self.EX_OK
diff --git a/xtesting/core/testcase.py b/xtesting/core/testcase.py
index 8faf3f43..bccf76d2 100644
--- a/xtesting/core/testcase.py
+++ b/xtesting/core/testcase.py
@@ -305,6 +305,8 @@ class TestCase():
path = urllib.parse.urlparse(dst_s3_url).path.strip("/")
dst_http_url = os.environ["HTTP_DST_URL"]
output_str = "\n"
+ # protects if test cases return details as None
+ self.details = self.details or {}
self.details["links"] = []
for log_file in [self.output_log_name, self.output_debug_log_name]:
if os.path.exists(os.path.join(self.dir_results, log_file)):