Skip to content
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

Invalid import path for BotoCoreError in redshift_info module #968

Closed
1 task done
winglot opened this issue Mar 7, 2022 · 4 comments · Fixed by #970
Closed
1 task done

Invalid import path for BotoCoreError in redshift_info module #968

winglot opened this issue Mar 7, 2022 · 4 comments · Fixed by #970
Labels
bug This issue/PR relates to a bug has_pr module module needs_triage plugins plugin (any type) python3

Comments

@winglot
Copy link
Contributor

winglot commented Mar 7, 2022

Summary

In case of any AWS related error (like missing permissions) the module will throw a gigantic python stack trace with error summary as:

line 304, in find_clusters
NameError: name 'BotoCoreError' is not defined

This is due to an invalid import path that is present in the module https://github.com/ansible-collections/community.aws/blob/main/plugins/modules/redshift_info.py#L280
Instead of from botocore.exception it should be from botocore.exceptions. Once that is done, ansible no longer hides the real error with the stack trace.

Issue Type

Bug Report

Component Name

redshift_info

Ansible Version

$ ansible --version
ansible 2.10.8
  config file = None
  configured module search path = ['/home/wojtek/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.9 (default, Jan 26 2021, 15:33:00) [GCC 8.4.0]

Collection Versions

Non-relevant

AWS SDK versions

$ pip show boto boto3 botocore
Name: boto
Version: 2.49.0
Summary: Amazon Web Services Library
Home-page: https://github.com/boto/boto/
Author: Mitch Garnaat
Author-email: mitch@garnaat.com
License: MIT
Location: /home/wojtek/.local/lib/python3.6/site-packages
Requires:
---
Name: boto3
Version: 1.20.54
Summary: The AWS SDK for Python
Home-page: https://github.com/boto/boto3
Author: Amazon Web Services
Author-email: None
License: Apache License 2.0
Location: /home/wojtek/.local/lib/python3.6/site-packages
Requires: jmespath, s3transfer, botocore
---
Name: botocore
Version: 1.23.54
Summary: Low-level, data-driven core of boto 3.
Home-page: https://github.com/boto/botocore
Author: Amazon Web Services
Author-email: None
License: Apache License 2.0
Location: /home/wojtek/.local/lib/python3.6/site-packages
Requires: jmespath, urllib3, python-dateutil

Configuration

$ ansible-config dump --only-changed

OS / Environment

Ubuntu 20.04

Steps to Reproduce

Run the module without DescribeClusters permission.

Expected Results

AWS API error on missing permissions is shown.

Actual Results

Python stack trace ending with

line 304, in find_clusters
NameError: name 'BotoCoreError' is not defined

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module needs_triage plugins plugin (any type) python3 labels Mar 7, 2022
@alinabuzachis
Copy link
Contributor

@winglot Thank for your bringing this. Would you be willing to open a pull request that fixes this import error?

@winglot
Copy link
Contributor Author

winglot commented Mar 7, 2022

@alinabuzachis Sure, the PR is ready.

softwarefactory-project-zuul bot pushed a commit that referenced this issue Mar 14, 2022
redshift_info - fix invalid import path for botocore exceptions

Depends-On: #979
SUMMARY



Fix invalid import path for botocore exceptions
Fixes #968

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME
redshift_info

Reviewed-by: Mark Woolley <mw@marknet15.com>
Reviewed-by: Alina Buzachis <None>
patchback bot pushed a commit that referenced this issue Mar 14, 2022
redshift_info - fix invalid import path for botocore exceptions

Depends-On: #979
SUMMARY

Fix invalid import path for botocore exceptions
Fixes #968

ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
redshift_info

Reviewed-by: Mark Woolley <mw@marknet15.com>
Reviewed-by: Alina Buzachis <None>
(cherry picked from commit 56f55fa)
patchback bot pushed a commit that referenced this issue Mar 14, 2022
redshift_info - fix invalid import path for botocore exceptions

Depends-On: #979
SUMMARY

Fix invalid import path for botocore exceptions
Fixes #968

ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
redshift_info

Reviewed-by: Mark Woolley <mw@marknet15.com>
Reviewed-by: Alina Buzachis <None>
(cherry picked from commit 56f55fa)
softwarefactory-project-zuul bot pushed a commit that referenced this issue Mar 15, 2022
#990)

[PR #970/56f55fac backport][stable-3] redshift_info - fix invalid import path for botocore exceptions

This is a backport of PR #970 as merged into main (56f55fa).
Depends-On: #979
SUMMARY



Fix invalid import path for botocore exceptions
Fixes #968

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME
redshift_info
softwarefactory-project-zuul bot pushed a commit that referenced this issue Mar 15, 2022
#989)

[PR #970/56f55fac backport][stable-2] redshift_info - fix invalid import path for botocore exceptions

This is a backport of PR #970 as merged into main (56f55fa).
Depends-On: #979
SUMMARY



Fix invalid import path for botocore exceptions
Fixes #968

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME
redshift_info
abikouo pushed a commit to abikouo/community.aws that referenced this issue Oct 24, 2023
…#968)

Minor sanity test fixes (new devel)

SUMMARY
ansible-devel has added a new PEP test (missing whitespace after keyword), this adds the fixes before the devel sanity tests are 'voting'.
Additionally fixes:

unused variables
broad catching of Exception

ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
plugins/action/s3_object.py
plugins/module_utils/elbv2.py
plugins/module_utils/waf.py
plugins/modules/aws_caller_info.py
plugins/modules/cloudformation.py
plugins/modules/ec2_metadata_facts.py
plugins/modules/ec2_security_group.py
plugins/modules/ec2_vpc_endpoint.py
plugins/modules/ec2_vpc_nat_gateway.py
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis <None>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug has_pr module module needs_triage plugins plugin (any type) python3
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants