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
ec2_elb module Python 3 Compat #50367
Conversation
@kepeket, just so you are aware we have a dedicated Working Group for aws. |
The test
The test
The test
The test
The test
The test
The test
The test
The test
The test
The test
The test
The test
The test
|
Python 3 sort() doest not benefits automatic type cast of objects into string (as Python27 does). Use a lambda to help the function sort the list with __repr__
Thanks @bbayszczak |
I have run into this issue myself now with ansible 2.7.10. |
FYI. I was able to workaround this issue by setting the interpreter just for the plays that call this module. Not a great solution, but it works for now.
|
Thank you very much for your interest in Ansible. Ansible has migrated much of the content into separate repositories to allow for more rapid, independent development. We are closing this issue/PR because this content has been moved to one or more collection repositories.
For further information, please see: |
Python 3 sort() does not benefits automatic
typecast of objects into a string (as Python27
does).
Use a lambda to help the function sort the list
with
__repr__
SUMMARY
When using this module on python3, it fails to sort() the LB objects that boto returns.
On python2, the automatic type casting was used during cmp was calling
__repr__
to cast as a string, then using__lt__
to perform the operator comparisonI'm proposing to ensure compatibility between the two python versions by passing a lambda in kwargs. It uses the
__repr__
to fallback to string comparison.ISSUE TYPE
COMPONENT NAME
ec2_elb
ADDITIONAL INFORMATION
1/ have an ASG or two in you AWS account
2/ try to unregister an instance from it using ec2_elb module (https://docs.ansible.com/ansible/latest/modules/ec2_elb_module.html#id5 example here)
3/ enjoy failure (TypeError: '<' not supported between instances of 'LoadBalancer' and 'LoadBalancer')