-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unexpected output from Python interpreter discovery with aws_ssm connection plugin #1756
Comments
We just ran into this issue here. It seems that Amazon Linux outputs colorized text when Ansible runs any remote shell commands which causes parsing of the result to fail. Our solution was to not use aws_ssm connection - instead we setup SSH to make connections through Session Manager: https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-getting-started-enable-ssh-connections.html |
I was facing this same issue with hosts running both Ubuntu 22.04 and Amazon Linux 2023, and I was finally able to trace the extra output to a root cause. This is due to newer versions of Bash/readline turning on the option I have a patch that will disable this option (will send a PR later today), which allows |
Confirmed it's working with Amazon Linux |
I've ended up having the same issue switching from amazon Linux 2 to amazon Linux 2023, my error was:
#1839 fixes it, but it's taking ages to be merged for unknown reasons. In the meantime I've set |
…1839) SUMMARY aws_ssm - prevent escape codes from interfering with output Fixes #1756 ISSUE TYPE Bugfix Pull Request COMPONENT NAME aws_ssm ADDITIONAL INFORMATION This disables the Readline feature enable-bracketed-paste which is enabled by default on Bash 5.1 and above. This was causing escape sequences like \x1b[?2004h\x1b[?2004l to get into the output from some operating systems (e.g. Amazon Linux).
…1839) SUMMARY aws_ssm - prevent escape codes from interfering with output Fixes #1756 ISSUE TYPE Bugfix Pull Request COMPONENT NAME aws_ssm ADDITIONAL INFORMATION This disables the Readline feature enable-bracketed-paste which is enabled by default on Bash 5.1 and above. This was causing escape sequences like \x1b[?2004h\x1b[?2004l to get into the output from some operating systems (e.g. Amazon Linux). (cherry picked from commit af18bc6)
…1839) SUMMARY aws_ssm - prevent escape codes from interfering with output Fixes #1756 ISSUE TYPE Bugfix Pull Request COMPONENT NAME aws_ssm ADDITIONAL INFORMATION This disables the Readline feature enable-bracketed-paste which is enabled by default on Bash 5.1 and above. This was causing escape sequences like \x1b[?2004h\x1b[?2004l to get into the output from some operating systems (e.g. Amazon Linux). (cherry picked from commit af18bc6)
…1839) (#2030) [PR #1839/af18bc61 backport][stable-7] Eliminate escape codes in aws_ssm output from newer versions of Bash This is a backport of PR #1839 as merged into main (af18bc6). SUMMARY aws_ssm - prevent escape codes from interfering with output Fixes #1756 ISSUE TYPE Bugfix Pull Request COMPONENT NAME aws_ssm ADDITIONAL INFORMATION This disables the Readline feature enable-bracketed-paste which is enabled by default on Bash 5.1 and above. This was causing escape sequences like \x1b[?2004h\x1b[?2004l to get into the output from some operating systems (e.g. Amazon Linux). Reviewed-by: Mark Chappell
@tremble Hi, you released v7.1.0 and its release note mentioned this issue fixed, but it is not. |
@Hokwang #1839 now results in the integration tests passing, which they previously didn't. This includes tests running against the latest Amazon Linux AMIs as exposed by Amazon as the SSM Parameter As such I can only respond with "Unable to Reproduce" at this time It would be helpful if you could provide details of exactly what error you're seeing against which AMI. I would strongly recommend opening a new issue (comments on closed issues are very easy to overlook), with much more detail than "still doesn't work for me". |
Summary
I had good luck with the aws_ssm plugin until attempting to use it against the latest Amazon Linux AMI. Simple commands that work well with a CentOS 7 host fails when trying to run them against AMI. It appears to be something to do with interpreting shell output.
A 'raw' command like this works fine:
However when running the equivalent 'command' module it fails for Amazon Linux, but works on CentOS 7.
Versus CentOS 7:
From '-vvvv' output I see things like this:
That's a failure to find the python version. Versus:
Where it didn't complain and seems to be successful. Notice the additional "x1b[?2004h\x1b[?2004" strings in the output.
I see the similar string in other problems, like "Warning: Failed to open the file 2004h2004l/AnsiballZ_command.py"
Note that if I set the python interpreter it will remove the warning, but it will still error out on the "Failed to open the file 2004h2004l/AnsiballZ_command.py: No such file Warning: or directory"
Tried this with community.aws collection versions 4.5.0, 5.2.0, and 5.3.0 and the errors is the same every time. Also tried a few different amazon.aws collection versions and had the same error.
These examples are taken from a Mac running python 3.11.2 and ansible 2.14.2, but the same errors occured in a Linux-based Execution Environment for AWX running in EKS.
Issue Type
Bug Report
Component Name
aws_ssm connection
Ansible Version
Collection Versions
AWS SDK versions
Configuration
OS / Environment
Darwin ENG-NMOSEMAN-MB 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:42:11 PST 2023; root:xnu-8792.81.3~2/RELEASE_X86_64 x86_64 i386 Darwin
and
modified version of quay.io/ansible/awx-ee:latest to include community.aws, and ssm stuff.
Steps to Reproduce
Expected Results
Actual Results
Code of Conduct
The text was updated successfully, but these errors were encountered: