From 7f33fcaf51ef105e058fd61f7ec37d848edf14b2 Mon Sep 17 00:00:00 2001 From: Taeho Park <113317744+taehopark32@users.noreply.github.com> Date: Tue, 27 Jun 2023 13:26:29 -0400 Subject: [PATCH] Lambda execute stack trace should be not formatted with extra space (#1615) Lambda execute stack trace should be not formatted with extra space SUMMARY Fixes #1497 ISSUE TYPE Bugfix Pull Request COMPONENT NAME plugins/modules/lambda_execute.py ADDITIONAL INFORMATION Reviewed-by: Jill R Reviewed-by: Bikouo Aubin Reviewed-by: Alina Buzachis Reviewed-by: Mike Graves (cherry picked from commit 271523ea97f73f0e4c5a027eac4f4fc72f4b7093) --- .../fragments/1615-no_formatted_with_extra_space.yml | 3 +++ plugins/modules/lambda_execute.py | 8 ++------ 2 files changed, 5 insertions(+), 6 deletions(-) create mode 100644 changelogs/fragments/1615-no_formatted_with_extra_space.yml diff --git a/changelogs/fragments/1615-no_formatted_with_extra_space.yml b/changelogs/fragments/1615-no_formatted_with_extra_space.yml new file mode 100644 index 0000000000..693362b695 --- /dev/null +++ b/changelogs/fragments/1615-no_formatted_with_extra_space.yml @@ -0,0 +1,3 @@ +--- +bugfixes: +- Fixes to the stack trace output, where it does not contain spaces between each character. The module had incorrectly always outputted extra spaces between each character. (https://github.com/ansible-collections/amazon.aws/pull/1615) \ No newline at end of file diff --git a/plugins/modules/lambda_execute.py b/plugins/modules/lambda_execute.py index 7f4b7aea10..10d38d1f59 100644 --- a/plugins/modules/lambda_execute.py +++ b/plugins/modules/lambda_execute.py @@ -262,14 +262,10 @@ def main(): "Function executed, but there was an error in the Lambda function. " "Message: {errmsg}, Type: {type}, Stack Trace: {trace}" ) + error_data = { # format the stacktrace sent back as an array into a multiline string - "trace": "\n".join( - [ - " ".join([str(x) for x in line]) # cast line numbers to strings - for line in results.get("output", {}).get("stackTrace", []) - ] - ), + "trace": "\n".join(results.get("output", {}).get("stackTrace", [])), "errmsg": results["output"].get("errorMessage"), "type": results["output"].get("errorType"), }