-
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
ResourceNotFoundException is raised when querying ACM certificates #622
Comments
sebastien-rosset
changed the title
ResourceNotFoundException is raised when retrieving list of certificates
ResourceNotFoundException is raised when querying ACM certificates
Jan 18, 2022
Files identified in the description:
If these files are inaccurate, please update the |
ansibullbot
added
bug
This issue/PR relates to a bug
has_pr
module_utils
module_utils
needs_triage
plugins
plugin (any type)
python3
traceback
labels
Jan 27, 2022
This was referenced Jan 28, 2022
softwarefactory-project-zuul bot
pushed a commit
that referenced
this issue
Feb 9, 2022
Handle ResourceNotFoundException while iterating certificates SUMMARY The module/utils/acm.py was not correctly handling deletion of certificates. While iterating over a list of certificates, the get_certificate function was making API calls to obtain more information about the certificates, but some certificates may be deleted while iterating. Fixes #622 ISSUE TYPE Bugfix Pull Request COMPONENT NAME acm.py ADDITIONAL INFORMATION Wow, it seems many tests are very flaky. I'm attempting to fix an issue in ACM, but problems occur elsewhere. Not to mention I raised this PR to fix #622, which was discovered while working on ansible-collections/community.aws#870. And I discovered other issues as well, and so it looks like it's not possible to make any progress without going down a tree of bug fixes. TypeError: 'NoneType' object is not subscriptable fatal: [testhost]: FAILED! => { "changed": false, "module_stderr": "Traceback (most recent call last):\n File \"<stdin>\", line 121, in <module>\n File \"<stdin>\", line 113, in _ansiballz_main\n File \"<stdin>\", line 61, in invoke_module\n File \"/usr/lib64/python3.8/runpy.py\", line 207, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib64/python3.8/runpy.py\", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib64/python3.8/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_ec2_vpc_igw_payload_g4o1kl_r/ansible_ec2_vpc_igw_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vpc_igw.py\", line 248, in <module>\n File \"/tmp/ansible_ec2_vpc_igw_payload_g4o1kl_r/ansible_ec2_vpc_igw_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vpc_igw.py\", line 242, in main\n File \"/tmp/ansible_ec2_vpc_igw_payload_g4o1kl_r/ansible_ec2_vpc_igw_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vpc_igw.py\", line 132, in process\n File \"/tmp/ansible_ec2_vpc_igw_payload_g4o1kl_r/ansible_ec2_vpc_igw_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vpc_igw.py\", line 220, in ensure_igw_present\n File \"/tmp/ansible_ec2_vpc_igw_payload_g4o1kl_r/ansible_ec2_vpc_igw_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vpc_igw.py\", line 158, in get_igw_info\nTypeError: 'NoneType' object is not subscriptable\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 } Reviewed-by: Alina Buzachis <None> Reviewed-by: Jill R <None>
patchback bot
pushed a commit
that referenced
this issue
Feb 9, 2022
Handle ResourceNotFoundException while iterating certificates SUMMARY The module/utils/acm.py was not correctly handling deletion of certificates. While iterating over a list of certificates, the get_certificate function was making API calls to obtain more information about the certificates, but some certificates may be deleted while iterating. Fixes #622 ISSUE TYPE Bugfix Pull Request COMPONENT NAME acm.py ADDITIONAL INFORMATION Wow, it seems many tests are very flaky. I'm attempting to fix an issue in ACM, but problems occur elsewhere. Not to mention I raised this PR to fix #622, which was discovered while working on ansible-collections/community.aws#870. And I discovered other issues as well, and so it looks like it's not possible to make any progress without going down a tree of bug fixes. TypeError: 'NoneType' object is not subscriptable fatal: [testhost]: FAILED! => { "changed": false, "module_stderr": "Traceback (most recent call last):\n File \"<stdin>\", line 121, in <module>\n File \"<stdin>\", line 113, in _ansiballz_main\n File \"<stdin>\", line 61, in invoke_module\n File \"/usr/lib64/python3.8/runpy.py\", line 207, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib64/python3.8/runpy.py\", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib64/python3.8/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_ec2_vpc_igw_payload_g4o1kl_r/ansible_ec2_vpc_igw_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vpc_igw.py\", line 248, in <module>\n File \"/tmp/ansible_ec2_vpc_igw_payload_g4o1kl_r/ansible_ec2_vpc_igw_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vpc_igw.py\", line 242, in main\n File \"/tmp/ansible_ec2_vpc_igw_payload_g4o1kl_r/ansible_ec2_vpc_igw_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vpc_igw.py\", line 132, in process\n File \"/tmp/ansible_ec2_vpc_igw_payload_g4o1kl_r/ansible_ec2_vpc_igw_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vpc_igw.py\", line 220, in ensure_igw_present\n File \"/tmp/ansible_ec2_vpc_igw_payload_g4o1kl_r/ansible_ec2_vpc_igw_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vpc_igw.py\", line 158, in get_igw_info\nTypeError: 'NoneType' object is not subscriptable\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 } Reviewed-by: Alina Buzachis <None> Reviewed-by: Jill R <None> (cherry picked from commit 4b12454)
softwarefactory-project-zuul bot
pushed a commit
that referenced
this issue
Feb 9, 2022
…657) [PR #646/4b124547 backport][stable-3] Handle ResourceNotFoundException while iterating certificates This is a backport of PR #646 as merged into main (4b12454). SUMMARY The module/utils/acm.py was not correctly handling deletion of certificates. While iterating over a list of certificates, the get_certificate function was making API calls to obtain more information about the certificates, but some certificates may be deleted while iterating. Fixes #622 ISSUE TYPE Bugfix Pull Request COMPONENT NAME acm.py ADDITIONAL INFORMATION Wow, it seems many tests are very flaky. I'm attempting to fix an issue in ACM, but problems occur elsewhere. Not to mention I raised this PR to fix #622, which was discovered while working on ansible-collections/community.aws#870. And I discovered other issues as well, and so it looks like it's not possible to make any progress without going down a tree of bug fixes. TypeError: 'NoneType' object is not subscriptable fatal: [testhost]: FAILED! => { "changed": false, "module_stderr": "Traceback (most recent call last):\n File \"<stdin>\", line 121, in <module>\n File \"<stdin>\", line 113, in _ansiballz_main\n File \"<stdin>\", line 61, in invoke_module\n File \"/usr/lib64/python3.8/runpy.py\", line 207, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib64/python3.8/runpy.py\", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib64/python3.8/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_ec2_vpc_igw_payload_g4o1kl_r/ansible_ec2_vpc_igw_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vpc_igw.py\", line 248, in <module>\n File \"/tmp/ansible_ec2_vpc_igw_payload_g4o1kl_r/ansible_ec2_vpc_igw_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vpc_igw.py\", line 242, in main\n File \"/tmp/ansible_ec2_vpc_igw_payload_g4o1kl_r/ansible_ec2_vpc_igw_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vpc_igw.py\", line 132, in process\n File \"/tmp/ansible_ec2_vpc_igw_payload_g4o1kl_r/ansible_ec2_vpc_igw_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vpc_igw.py\", line 220, in ensure_igw_present\n File \"/tmp/ansible_ec2_vpc_igw_payload_g4o1kl_r/ansible_ec2_vpc_igw_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vpc_igw.py\", line 158, in get_igw_info\nTypeError: 'NoneType' object is not subscriptable\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 }
abikouo
pushed a commit
to abikouo/amazon.aws
that referenced
this issue
Oct 24, 2023
…luster-is-slow_26143 test: aws_msk_cluster is slow The aws_msk_cluster test takes a bit of time. Let's be sure this does not become a problem in the future by isolating it on its own dedicated job.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
A
ResourceNotFoundException
may be raised when a ansible module invokes the get_certificates function defined in module_utils/acm.py. It looks like there is an intermittent timing issue:get_certificates
function gets all certificates defined in ACM using paginated queries.ResourceNotFoundException
.Issue Type
Bug Report
Component Name
acm in module_utils
Ansible Version
Collection Versions
AWS SDK versions
Configuration
$ ansible-config dump --only-changed
OS / Environment
CentOS Linux release 7.9.2009 (Core)
Linux 5ada6014185e 5.11.0-43-generic #47~20.04.2-Ubuntu SMP Mon Dec 13 11:06:56 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Steps to Reproduce
The issue occurs intermittently when running the integration tests for the
acm
module incommunity.aws
. Specifically when acommunity.aws.aws_acm
task deletes a cert, followed by thecommunity.aws.aws_acm_info
. TheResourceNotFoundException
occurs in theaws_acm_info
task.The problem occurs when a cert is removed from ACM while
acm.py:get_certificates
iterates a list of cert ARNs. The problem is more likely to occur if theacm.py:get_certificates
takes a long time to iterate over the certificate ARNs. For example this could happen if there are lots of certificates in ACM.If there are N certificates in ACM,
get_certificates
could send up to 1 + 3 * N requests to the AWS API, not counting the retries (for each cert,get_certificates
makes up to 2 or 3 AWS API calls depending on the cert status.)Expected Results
I was expecting
community.aws.aws_acm_info
to return a list of certificates successfully, even if certificates are being deleted while querying the certs. Internally theaws_acm_info
module invokes theamazon.aws:get_certificates
function which is defined in module_utils/acm.py. That function should skip certificates when aResourceNotFound
exception is raised. I.e. don't return certs that are being deleted.The problem exists in the
main
branch.Actual Results
An exception is raised while executing the
aws_acm_info
task.Code of Conduct
The text was updated successfully, but these errors were encountered: