From 9c545f2b8ac23983b2b99ff1388a9e6962a8f6d8 Mon Sep 17 00:00:00 2001 From: Taeho Park Date: Fri, 16 Jun 2023 17:43:17 -0400 Subject: [PATCH 1/6] change from receiving a list of strings to a string --- plugins/modules/lambda_execute.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/modules/lambda_execute.py b/plugins/modules/lambda_execute.py index 7f4b7aea109..d354d695f9b 100644 --- a/plugins/modules/lambda_execute.py +++ b/plugins/modules/lambda_execute.py @@ -266,8 +266,7 @@ def main(): # 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", []) + line for line in results.get("output", {}).get("stackTrace", []) ] ), "errmsg": results["output"].get("errorMessage"), From 9712d98831717fd8266da068c135cac4db09bb39 Mon Sep 17 00:00:00 2001 From: Taeho Park Date: Wed, 21 Jun 2023 10:43:06 -0400 Subject: [PATCH 2/6] added fragments --- changelogs/fragments/1604-no_formatted_with_extra_space.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelogs/fragments/1604-no_formatted_with_extra_space.yml diff --git a/changelogs/fragments/1604-no_formatted_with_extra_space.yml b/changelogs/fragments/1604-no_formatted_with_extra_space.yml new file mode 100644 index 00000000000..693362b6950 --- /dev/null +++ b/changelogs/fragments/1604-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 From 9d318d96be11eaed42e0165762b3edbb0445de4c Mon Sep 17 00:00:00 2001 From: Taeho Park Date: Wed, 21 Jun 2023 11:30:55 -0400 Subject: [PATCH 3/6] change fragment name --- ...h_extra_space.yml => 1615-no_formatted_with_extra_space.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename changelogs/fragments/{1604-no_formatted_with_extra_space.yml => 1615-no_formatted_with_extra_space.yml} (82%) diff --git a/changelogs/fragments/1604-no_formatted_with_extra_space.yml b/changelogs/fragments/1615-no_formatted_with_extra_space.yml similarity index 82% rename from changelogs/fragments/1604-no_formatted_with_extra_space.yml rename to changelogs/fragments/1615-no_formatted_with_extra_space.yml index 693362b6950..fd7b8945c7f 100644 --- a/changelogs/fragments/1604-no_formatted_with_extra_space.yml +++ b/changelogs/fragments/1615-no_formatted_with_extra_space.yml @@ -1,3 +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 +- 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 From ab3d1d75b689e0c50b3dbb5051e10ba8da825a04 Mon Sep 17 00:00:00 2001 From: Taeho Park <113317744+taehopark32@users.noreply.github.com> Date: Thu, 22 Jun 2023 10:09:21 -0400 Subject: [PATCH 4/6] Update changelogs/fragments/1615-no_formatted_with_extra_space.yml Co-authored-by: Jill R <4121322+jillr@users.noreply.github.com> --- changelogs/fragments/1615-no_formatted_with_extra_space.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelogs/fragments/1615-no_formatted_with_extra_space.yml b/changelogs/fragments/1615-no_formatted_with_extra_space.yml index fd7b8945c7f..99f86554cab 100644 --- a/changelogs/fragments/1615-no_formatted_with_extra_space.yml +++ b/changelogs/fragments/1615-no_formatted_with_extra_space.yml @@ -1,3 +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 +- 'lambda_execute - 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 From 8cfeaaed5e2e769ae7c499e33ff32b0079917c99 Mon Sep 17 00:00:00 2001 From: Taeho Park Date: Thu, 22 Jun 2023 10:28:21 -0400 Subject: [PATCH 5/6] used more concise coding for listing stack trace --- changelogs/fragments/1615-no_formatted_with_extra_space.yml | 2 +- plugins/modules/lambda_execute.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/changelogs/fragments/1615-no_formatted_with_extra_space.yml b/changelogs/fragments/1615-no_formatted_with_extra_space.yml index 99f86554cab..693362b6950 100644 --- a/changelogs/fragments/1615-no_formatted_with_extra_space.yml +++ b/changelogs/fragments/1615-no_formatted_with_extra_space.yml @@ -1,3 +1,3 @@ --- bugfixes: -- 'lambda_execute - 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 +- 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 d354d695f9b..f7655545838 100644 --- a/plugins/modules/lambda_execute.py +++ b/plugins/modules/lambda_execute.py @@ -262,11 +262,12 @@ 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( [ - line for line in results.get("output", {}).get("stackTrace", []) + list(results.get("output", {}).get("stackTrace", [])) ] ), "errmsg": results["output"].get("errorMessage"), From 90476f359136c86a03a88169a82b38a6a8f22ce0 Mon Sep 17 00:00:00 2001 From: Taeho Park Date: Thu, 22 Jun 2023 12:07:31 -0400 Subject: [PATCH 6/6] more concise of retrieving stack trace --- plugins/modules/lambda_execute.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/plugins/modules/lambda_execute.py b/plugins/modules/lambda_execute.py index f7655545838..10d38d1f59d 100644 --- a/plugins/modules/lambda_execute.py +++ b/plugins/modules/lambda_execute.py @@ -265,11 +265,7 @@ def main(): error_data = { # format the stacktrace sent back as an array into a multiline string - "trace": "\n".join( - [ - list(results.get("output", {}).get("stackTrace", [])) - ] - ), + "trace": "\n".join(results.get("output", {}).get("stackTrace", [])), "errmsg": results["output"].get("errorMessage"), "type": results["output"].get("errorType"), }