-
Notifications
You must be signed in to change notification settings - Fork 343
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
AttributeError: 'module' object has no attribute 'JSONDecodeError' #1358
Comments
Files identified in the description: If these files are inaccurate, please update the |
Many thanks for taking the time to report this issue. The issue here is that between Python 3 and Python 2 the Exception raised by the json module changed. With the Python 3 exception not being available on older Python 2 hosts. While the bulk of this collection has dropped support for Python <3.6, I believe it's appropriate for this specific module to continue to support Python 2.7, since it doesn't depend on the botocore SDK (which drives our Python support policy). I've added a fix in #1359, and included a specific integration test for running this against Python 2.x hosts. |
… hosts (#1359) ec2_metadata_facts - fix AttributeError when running on older managed hosts SUMMARY Unlike most of our modules, the ec2_metadata_facts is always expected to run on managed hosts, and doesn't depend on the AWS SDKs. With Python 2.7 support still in place for managed hosts on all supported Ansible versions it makes sense, in the specific case of ec2_metadata_facts, to continue to support Python 2.7 for now. ISSUE TYPE Bugfix Pull Request COMPONENT NAME ec2_metadata_facts ADDITIONAL INFORMATION fixes: #1358 Reviewed-by: Bikouo Aubin Reviewed-by: Alina Buzachis
I have seen development activity for this issue and waited for the new 7.3.0 Ansible version. It does not seem to be resolved in this version? Is that correct, or am I missing something? |
@tomdeblende it looks like the fix didn't get backported to the 5.x release of this collection (I missed that the automatic backport failed). Collections can be updated separately from Ansible. This fix will be available with Release 6.0.0 of the collection, and hopefully 5.4.0 if a manual backport is successful |
…ta_facts - fix AttributeError when running on older managed hosts ec2_metadata_facts - fix AttributeError when running on older managed hosts ##### SUMMARY Unlike most of our modules, the ec2_metadata_facts is always expected to run on managed hosts, and doesn't depend on the AWS SDKs. With Python 2.7 support still in place for managed hosts on all supported Ansible versions it makes sense, in the specific case of ec2_metadata_facts, to continue to support Python 2.7 for now. ##### ISSUE TYPE Bugfix Pull Request ##### COMPONENT NAME ec2_metadata_facts ##### ADDITIONAL INFORMATION fixes: ansible-collections#1358
…ibuteError when running on older managed hosts (#1420) [PR #1359/31570048 backport] [stable-5] ec2_metadata_facts - fix AttributeError when running on older managed hosts This is a MANUAL backport of PR #1359 as merged into main (3157004). SUMMARY Unlike most of our modules, the ec2_metadata_facts is always expected to run on managed hosts, and doesn't depend on the AWS SDKs. With Python 2.7 support still in place for managed hosts on all supported Ansible versions it makes sense, in the specific case of ec2_metadata_facts, to continue to support Python 2.7 for now. ISSUE TYPE Bugfix Pull Request COMPONENT NAME ec2_metadata_facts ADDITIONAL INFORMATION fixes: #1358
@tremble where can I check when 5.4.0 will be released? Looking at https://github.com/ansible-collections/amazon.aws/releases I see 5.3.0 is not listed while it is already available. |
@tomdeblende There's no official date yet. The short answer is "Real Soon Now". Unfortunately none of the usual suspects were able to meet the monthly working group meeting yesterday which is when we'd normally discuss the release. I'll poke folks and see if we can get the process started. |
Summary
When using amazon.aws.ec2_metadata_facts on CentOS 7, Amazon Linux 1 and Amazon Linux 2, I get this error:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'module' object has no attribute 'JSONDecodeError'
On more recent OS'es it works fine.
Issue Type
Bug Report
Component Name
amazon.aws.ec2_metadata_facts
Ansible Version
Collection Versions
AWS SDK versions
Configuration
OS / Environment
Amazon Linux 2022
Steps to Reproduce
- amazon.aws.ec2_metadata_facts:
Expected Results
Being able to use the variables set by amazon.aws.ec2_metadata_facts.
Actual Results
Code of Conduct
The text was updated successfully, but these errors were encountered: