From b65aaa8f9ad94b7e2ad1f8646d5e4bc3e5e090be Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Tue, 9 Apr 2019 23:08:31 -0700 Subject: [PATCH] [stable-2.7] Compat fix for ansible-core-ci on Python 3.7. (cherry picked from commit 5b133f345558998074138b94b290a2cf8dd456fd) Co-authored-by: Matt Clay --- test/runner/lib/core_ci.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/runner/lib/core_ci.py b/test/runner/lib/core_ci.py index 7ae79996e56..3a44fc49b09 100644 --- a/test/runner/lib/core_ci.py +++ b/test/runner/lib/core_ci.py @@ -496,7 +496,14 @@ class AnsibleCoreCI(object): elif 'errorMessage' in response_json: message = response_json['errorMessage'].strip() if 'stackTrace' in response_json: - trace = '\n'.join([x.rstrip() for x in traceback.format_list(response_json['stackTrace'])]) + traceback_lines = response_json['stackTrace'] + + # AWS Lambda on Python 2.7 returns a list of tuples + # AWS Lambda on Python 3.7 returns a list of strings + if traceback_lines and isinstance(traceback_lines[0], list): + traceback_lines = traceback.format_list(traceback_lines) + + trace = '\n'.join([x.rstrip() for x in traceback_lines]) stack_trace = ('\nTraceback (from remote server):\n%s' % trace) else: message = str(response_json)