From 9dc78e1e3b9a044014289140495ad2dc940fb0e6 Mon Sep 17 00:00:00 2001 From: Matteo Pompili <6500688+matpompili@users.noreply.github.com> Date: Mon, 22 Apr 2024 14:47:13 -0700 Subject: [PATCH 1/6] If the return code contains #CLIXML (like a progress bar) remove it --- plugins/connection/aws_ssm.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/connection/aws_ssm.py b/plugins/connection/aws_ssm.py index 5c2d6d57788..84fd307bb98 100644 --- a/plugins/connection/aws_ssm.py +++ b/plugins/connection/aws_ssm.py @@ -748,6 +748,10 @@ def _post_process(self, stdout, mark_begin): # output to keep will be before the mark stdout = stdout[:stdout.rfind(mark_begin)] # fmt: skip + # If the return code contains #CLIXML (like a progress bar) remove it + clixml_filter = re.compile(r'#<\sCLIXML\s') + stdout = clixml_filter.sub('', stdout) + # If it looks like JSON remove any newlines if stdout.startswith("{"): stdout = stdout.replace("\n", "") From 11e6341663f2176230f290137e176ba39285205a Mon Sep 17 00:00:00 2001 From: Matteo Pompili Date: Tue, 23 Apr 2024 08:33:22 -0700 Subject: [PATCH 2/6] lint with black --- plugins/connection/aws_ssm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/connection/aws_ssm.py b/plugins/connection/aws_ssm.py index 84fd307bb98..0dae5092876 100644 --- a/plugins/connection/aws_ssm.py +++ b/plugins/connection/aws_ssm.py @@ -749,8 +749,8 @@ def _post_process(self, stdout, mark_begin): stdout = stdout[:stdout.rfind(mark_begin)] # fmt: skip # If the return code contains #CLIXML (like a progress bar) remove it - clixml_filter = re.compile(r'#<\sCLIXML\s') - stdout = clixml_filter.sub('', stdout) + clixml_filter = re.compile(r"#<\sCLIXML\s") + stdout = clixml_filter.sub("", stdout) # If it looks like JSON remove any newlines if stdout.startswith("{"): From ec2830fb2c7a30fe8cee5d6329207919f177c7b5 Mon Sep 17 00:00:00 2001 From: Matteo Pompili <6500688+matpompili@users.noreply.github.com> Date: Fri, 26 Apr 2024 11:18:14 -0700 Subject: [PATCH 3/6] added changelog fragment --- changelogs/fragments/20240426_fix_ssm_clixml.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelogs/fragments/20240426_fix_ssm_clixml.yml diff --git a/changelogs/fragments/20240426_fix_ssm_clixml.yml b/changelogs/fragments/20240426_fix_ssm_clixml.yml new file mode 100644 index 00000000000..50f4d0af289 --- /dev/null +++ b/changelogs/fragments/20240426_fix_ssm_clixml.yml @@ -0,0 +1,2 @@ +bugfixes: + - ssm - strip Powershell CLIXML from stdout (https://github.com/ansible-collections/community.aws/issues/1952). \ No newline at end of file From 89976f71a3aac49d59cb16686947fdeeb2f6af88 Mon Sep 17 00:00:00 2001 From: Matteo Pompili <6500688+matpompili@users.noreply.github.com> Date: Thu, 26 Dec 2024 17:26:16 +0100 Subject: [PATCH 4/6] Add EOL to changelog fragment --- changelogs/fragments/20240426_fix_ssm_clixml.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelogs/fragments/20240426_fix_ssm_clixml.yml b/changelogs/fragments/20240426_fix_ssm_clixml.yml index 50f4d0af289..5f230f4d634 100644 --- a/changelogs/fragments/20240426_fix_ssm_clixml.yml +++ b/changelogs/fragments/20240426_fix_ssm_clixml.yml @@ -1,2 +1,2 @@ bugfixes: - - ssm - strip Powershell CLIXML from stdout (https://github.com/ansible-collections/community.aws/issues/1952). \ No newline at end of file + - ssm - strip Powershell CLIXML from stdout (https://github.com/ansible-collections/community.aws/issues/1952). From ce873d3aab2d8a6083bc4231b5a5cb4dea1dc1f8 Mon Sep 17 00:00:00 2001 From: Matteo Pompili <6500688+matpompili@users.noreply.github.com> Date: Thu, 26 Dec 2024 18:00:34 +0100 Subject: [PATCH 5/6] Comment out PR code to check if that is the issue in the CI pipeline. --- plugins/connection/aws_ssm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/connection/aws_ssm.py b/plugins/connection/aws_ssm.py index 0dae5092876..4f13b0653cb 100644 --- a/plugins/connection/aws_ssm.py +++ b/plugins/connection/aws_ssm.py @@ -749,8 +749,8 @@ def _post_process(self, stdout, mark_begin): stdout = stdout[:stdout.rfind(mark_begin)] # fmt: skip # If the return code contains #CLIXML (like a progress bar) remove it - clixml_filter = re.compile(r"#<\sCLIXML\s") - stdout = clixml_filter.sub("", stdout) + # clixml_filter = re.compile(r"#<\sCLIXML\s") + # stdout = clixml_filter.sub("", stdout) # If it looks like JSON remove any newlines if stdout.startswith("{"): From 00b3ffe826a93229de9c27a2e73c791462defd14 Mon Sep 17 00:00:00 2001 From: Matteo Pompili <6500688+matpompili@users.noreply.github.com> Date: Thu, 26 Dec 2024 18:52:57 +0100 Subject: [PATCH 6/6] Bring back changes, they were not the issue. --- plugins/connection/aws_ssm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/connection/aws_ssm.py b/plugins/connection/aws_ssm.py index 4f13b0653cb..0dae5092876 100644 --- a/plugins/connection/aws_ssm.py +++ b/plugins/connection/aws_ssm.py @@ -749,8 +749,8 @@ def _post_process(self, stdout, mark_begin): stdout = stdout[:stdout.rfind(mark_begin)] # fmt: skip # If the return code contains #CLIXML (like a progress bar) remove it - # clixml_filter = re.compile(r"#<\sCLIXML\s") - # stdout = clixml_filter.sub("", stdout) + clixml_filter = re.compile(r"#<\sCLIXML\s") + stdout = clixml_filter.sub("", stdout) # If it looks like JSON remove any newlines if stdout.startswith("{"):