-
Notifications
You must be signed in to change notification settings - Fork 397
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
Fix aws_ssm fails when gathering facts #583
Conversation
Thanks for taking the time to submit this PR. I've not got the time to review it right now, however the sanity tests are throwing some errors that should be fixed: https://dashboard.zuul.ansible.com/t/ansible/build/c060c97822fe445fabfd681f5dfd6ca3/console
|
I had to revert the linux cmd f(printf ...) statements that were suggested by others, it wasn't going to pass the python2.6 checks. I went back to the old cmd method and modified it with ';'s so it works as expected and passes the python2.6 tests. I also modified a few of the logging lines while i was in here to have it log in vvvv so that it doesn't show up in debug logs, only in connection. I've tested in each OS we support and it is working as expected. |
@tremble Should this be assigned to someone for review? |
For the record, we now only support Py38+. It's a pretty recent change thus. |
Can you quickly explain how you do you tests? Maybe you've got a test playbook? |
Our tests are not really official but seem to work ok. I have a CF template to build an ec2 instance for each OS we support at our company. We have a system in place to kick off our playbooks using cloudwatch events, step functions, and fargate. It will run through our standard playbook to configure the ec2. We visually look at ansible logs to see if the playbooks ran correctly. I've found a few bugs using this test so it seems work, though not very automated and probably doesn't test every possibility. |
Did you also test on Ubuntu 20.04? Works on Amazon Linux but not Ubuntu for me
|
I did not test ubuntu, it's not one of the OSs we support, however i think i found the problem. There were two issues. The first is it did not detect the proper command output for ubuntu, so i modified the check to ensure that it finds the right output. Once that worked it then did not like the old method of wrapping the command, but it does work with the new printf statements. I put the printf statements back and ubuntu is working. I don't have an extended playbook for ubuntu, i pretty much just did a quick gather facts and it works. I also tested ubuntu 18.04 and it works now as well. I redid my tests for each OS we support and they work still. So if the automated testing doesn't check old python versions anymore then it should pass those checks. Let me know if that works ok for you now. |
Looks like it's still failing on those older versions of python that do not support f strings. Do we need to find a solution that works with all those older versions still? |
The change seemed to have broke something because it's not working for both Ubuntu and Amazon Linux now. Counts down 'EXEC remaining' and loops. What seemed to work for me for both Amazon Linux and Ubuntu was the patched code posted on #113
|
Sorry about that, i had a typo when i transferred the edits to this repo. Please test again and let me know if that worked. I've tested on ansible linux and ubuntu and it appears to work ok for me. |
@richardsonky It's working now on both Ubuntu and Amazon Linux now. Thanks for the fix! |
@goneri |
I mean, we support py38+ on the controller side. We continue to support py2 on the remote nodes. |
Ansible-test still checks with Python 2.6 to 3.7. To keep it quiet, we use ignore files to disable some checks: https://github.com/ansible-collections/community.aws/tree/main/tests/sanity |
recheck |
I've just pushed #621 to extend these filters. |
We support 3.6+ for the AWS collections, but we definitely don't need to be testing on 2.x any longer. |
Is there any news about this PR ? Looks like #621 is not needed anymore. |
This PR fixes this issue for me as well - any chance this can be merged? |
This PR also fixes the issue for me. What left to be done to get it merged? |
Merge Failed. This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset. |
2 similar comments
Merge Failed. This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset. |
Merge Failed. This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset. |
remove unnecessary changes add fragment fix changelog fix pep8 issues fix indent modification to pass python2.6 tests update to fix ubuntu. need to use new printf method fix typo in condition
@richardsonky This PR was evaluated as a potentially problematic PR for the following reasons:
Such PR can only be merged by human. Contact a Core team member to review this PR on IRC: |
Merge Failed. This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset. |
not sure what i'm doing, so closing and will reopen a new one |
Reference: #948 (comment) |
aws_ec2 fix hostnames SUMMARY aws_ec2- fix hostnames bugs Should fix ansible-collections#582 and ansible-collections#583 Fix returned hosts when hostnames: - tag:Tag1,Tag2 Fix returned hosts when hostnames: - tag:Tag1 - tag:Tag2 Fix returned hosts when hostnames: - tag:Tag1=Test1,Tag2=Test2 Given and EC2 instance with the following tags tags: Tag1: Test1 Tag2: Test2 Instead of only returning "aws_ec2": { "hosts": [ "Test1" ] }, "tag_Name_instance_02": { "hosts": [ "Test1" ] }, "tag_Tag1_Test1": { "hosts": [ "Test1" ] }, "tag_Tag2_Test2": { "hosts": [ "Test1" ] } It returns now { "_meta": { "hostvars": { "Test1": { "ami_launch_index": 0, "ansible_host": "10.210.0.101", ...}, "Test2": { "ami_launch_index": 0, "ansible_host": "10.210.0.101", ...}, }, "all": { "children": [ "aws_ec2", "tag_Name_instance_02", "tag_Tag1_Test1", "tag_Tag2_Test2", "ungrouped" ] }, "aws_ec2": { "hosts": [ "Test1", "Test2" ] }, "tag_Name_instance_02": { "hosts": [ "Test1", "Test2" ] }, "tag_Tag1_Test1": { "hosts": [ "Test1", "Test2" ] }, "tag_Tag2_Test2": { "hosts": [ "Test1", "Test2" ] } } ISSUE TYPE Bugfix Pull Request COMPONENT NAME aws_ec2 ADDITIONAL INFORMATION Reviewed-by: Mark Chappell <None> Reviewed-by: Alina Buzachis <None> Reviewed-by: Markus Bergholz <[email protected]>
Depends-On: #621
SUMMARY
Fixes #113
aws_ssm fails when gathering facts. This fix incorporates some code submitted by others, but also works on windows which others haven't done yet.
ISSUE TYPE
COMPONENT NAME
aws_ssm
ADDITIONAL INFORMATION
Fixes aws_ssm connection plugin when gathering facts. Uses code a few others submitted but also fixes windows.
Changed logic in the exec_command, wrap_command, and post_process functions that help to unify the output from windows and linux to make it easier to locate return values of the commands.
We have been running this in our environment for over a month and it is working without issue against win2016, win2019, centos7, suse15, and rhel7 ec2 instances.