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

'NoneType' object is not subscriptable error in ec2_vpc_igw module #647

Closed
1 task done
sebastien-rosset opened this issue Jan 28, 2022 · 11 comments · Fixed by #672, #691, #695 or #766
Closed
1 task done

'NoneType' object is not subscriptable error in ec2_vpc_igw module #647

sebastien-rosset opened this issue Jan 28, 2022 · 11 comments · Fixed by #672, #691, #695 or #766
Labels
bug This issue/PR relates to a bug CI has_pr module module plugins plugin (any type) python3 traceback

Comments

@sebastien-rosset
Copy link
Contributor

sebastien-rosset commented Jan 28, 2022

Summary

When submitting #646 to fix bug #622, the integration tests fail in the ec2_vpc_igw module. This seems to be unrelated to the changes I made in the aws_acm module.

The ec2_vpc_igw module fails with TypeError: 'NoneType' object is not subscriptable. I don't think the module should ever fail with a NoneType error.

Issue Type

Bug Report

Component Name

ec2_vpc_igw

Ansible Version

The environment (ansible version, collection version, SDK, OS...) is entirely determined by the PR process. The failures of the integration tests are here: #646 and https://ansible.softwarefactory-project.io/zuul/build/cb5198eefa104eeb9cd5c8bc6e12bdc1

It's not clear which part of the zuul logs contain the details about the environment. I've copy-pasted some data from the zuul logs.

2022-01-28 14:24:20.068273 | 
2022-01-28 14:24:20.068478 | TASK [emit-job-header : Print job information]
2022-01-28 14:24:20.662964 | # Job Information
2022-01-28 14:24:20.663164 | Ansible Version: 2.9.16
2022-01-28 14:24:20.663198 | Job: ansible-test-cloud-integration-aws-py38_3
2022-01-28 14:24:20.663225 | Pipeline: check
2022-01-28 14:24:20.663250 | Executor: ze06.softwarefactory-project.io
2022-01-28 14:24:20.663275 | Triggered by: https://github.com/ansible-collections/amazon.aws/pull/646
2022-01-28 14:24:20.663299 | Log URL (when completed): https://ansible.softwarefactory-project.io/logs/46/646/d444627c887c44c244ef257e68d45a892f10f772/check/ansible-test-cloud-integration-aws-py38_3/cb5198e/
2022-01-28 14:24:20.663324 | Event ID: 79a6d1b0-8044-11ec-8e57-1426c1318593

Collection Versions

$ ansible-galaxy collection list

AWS SDK versions

$ pip show boto boto3 botocore

Configuration

$ ansible-config dump --only-changed

OS / Environment

No response

Steps to Reproduce

Expected Results

I expected the PR integration tests to complete without error. Or at least to complete without any error outside the changes I made.
More specifically:

  1. The integration tests for the ec2_vpc_igw module should not fail.
  2. When a problem does occur in the ec2_vpc_igw module, it should handle the error more gracefully, not by raising a'NoneType' object is not subscriptable exception

"/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
TypeError: 'NoneType' object is not subscriptable

Actual Results

The PR integration tests fail in the following modules:

ERROR: The 2 integration test(s) listed below (out of 8) failed. See error output above for details:
ec2_vpc_igw
ec2_vpc_route_table

Here is a specific stack trace for the ec2_vpc_igw module.

Traceback (most recent call last):
  File "<stdin>", line 121, in <module>
  File "<stdin>", line 113, in _ansiballz_main
  File "<stdin>", line 61, in invoke_module
  File "/usr/lib64/python3.8/runpy.py", line 207, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib64/python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/lib64/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  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>
  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
  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
  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
  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
TypeError: 'NoneType' object is not subscriptable

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

@alinabuzachis
Copy link
Contributor

alinabuzachis commented Feb 1, 2022

This PR #672 should fix it.

@jatorcasso
Copy link
Contributor

@alinabuzachis I'm still running into this issue when running integration tests for ec2_vpc_route_table

Traceback (most recent call last):
  File "<stdin>", line 121, in <module>
  File "<stdin>", line 113, in _ansiballz_main
  File "<stdin>", line 61, in invoke_module
  File "/usr/lib64/python3.8/runpy.py", line 207, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib64/python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/lib64/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_ec2_vpc_igw_payload_jxieg1a_/ansible_ec2_vpc_igw_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vpc_igw.py", line 249, in <module>
  File "/tmp/ansible_ec2_vpc_igw_payload_jxieg1a_/ansible_ec2_vpc_igw_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vpc_igw.py", line 243, in main
  File "/tmp/ansible_ec2_vpc_igw_payload_jxieg1a_/ansible_ec2_vpc_igw_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vpc_igw.py", line 132, in process
  File "/tmp/ansible_ec2_vpc_igw_payload_jxieg1a_/ansible_ec2_vpc_igw_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vpc_igw.py", line 221, in ensure_igw_present
  File "/tmp/ansible_ec2_vpc_igw_payload_jxieg1a_/ansible_ec2_vpc_igw_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vpc_igw.py", line 158, in get_igw_info
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_jxieg1a_/ansible_ec2_vpc_igw_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vpc_igw.py\", line 249, in <module>\n  File \"/tmp/ansible_ec2_vpc_igw_payload_jxieg1a_/ansible_ec2_vpc_igw_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vpc_igw.py\", line 243, in main\n  File \"/tmp/ansible_ec2_vpc_igw_payload_jxieg1a_/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_jxieg1a_/ansible_ec2_vpc_igw_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vpc_igw.py\", line 221, in ensure_igw_present\n  File \"/tmp/ansible_ec2_vpc_igw_payload_jxieg1a_/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",

@jillr jillr reopened this Feb 23, 2022
softwarefactory-project-zuul bot pushed a commit that referenced this issue Mar 1, 2022
ec2_vpc_igw: fix 'NoneType' object is not subscriptable

Depends-On: ansible/ansible-zuul-jobs#1368
SUMMARY
Add "InternetGatewayAttached" waiter
Fixes #647
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
ec2_vpc_igw

Reviewed-by: Alina Buzachis <None>
Reviewed-by: Joseph Torcasso <None>
Reviewed-by: Jill R <None>
Reviewed-by: Abhijeet Kasurde <None>
jatorcasso added a commit to jatorcasso/amazon.aws that referenced this issue Mar 1, 2022
…ections#691)

ec2_vpc_igw: fix 'NoneType' object is not subscriptable

Depends-On: ansible/ansible-zuul-jobs#1368
SUMMARY
Add "InternetGatewayAttached" waiter
Fixes ansible-collections#647
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
ec2_vpc_igw

Reviewed-by: Alina Buzachis <None>
Reviewed-by: Joseph Torcasso <None>
Reviewed-by: Jill R <None>
Reviewed-by: Abhijeet Kasurde <None>
@sebastien-rosset
Copy link
Contributor Author

I still see the issue when I run the integration tests in #631

@jatorcasso
Copy link
Contributor

So adding a waiter after attaching the igw still isnt enough it seems? Thoughts on waiting for igw after ensuring tags? @alinabuzachis

@alinabuzachis
Copy link
Contributor

alinabuzachis commented Mar 2, 2022

So adding a waiter after attaching the igw still isnt enough it seems? Thoughts on waiting for igw after ensuring tags? @alinabuzachis

Ok, I will also try to have a look if the error persists. BTW, the CI seems green now. @sebastien-rosset please feel free to open an issue if you encounter this issue again.

@jatorcasso
Copy link
Contributor

jatorcasso commented Mar 2, 2022

The waiter I added after attaching definitely helps - it used to fail about 10% of the time and now its about 2% of the time (I ran bash scripts to run 50 iterations) - but the main problem is just the instability of calling describe_internet_gateways. We might just have to do a manual waiter prior to calling ensure_ec2_tags then again after and just return the gw directly to make 100% sure we have the object. Not pretty but I'm not sure what else we can do.

@jillr jillr reopened this Mar 2, 2022
softwarefactory-project-zuul bot pushed a commit that referenced this issue Mar 4, 2022
`ec2_vpc_igw`: fix NoneType error

SUMMARY

use paginator for describe internet gateways and add retry_codes='InvalidInternetGatewayID.NotFound' (thanks @alinabuzachis)
Fixes #647

ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
ec2_vpc_igw
ADDITIONAL INFORMATION

previously added InternetGatewayAttached waiter but problem still persists (#691)

Reviewed-by: Abhijeet Kasurde <None>
Reviewed-by: Jill R <None>
alinabuzachis pushed a commit to alinabuzachis/amazon.aws that referenced this issue Mar 4, 2022
…ections#691)

ec2_vpc_igw: fix 'NoneType' object is not subscriptable

Depends-On: ansible/ansible-zuul-jobs#1368
SUMMARY
Add "InternetGatewayAttached" waiter
Fixes ansible-collections#647
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
ec2_vpc_igw

Reviewed-by: Alina Buzachis <None>
Reviewed-by: Joseph Torcasso <None>
Reviewed-by: Jill R <None>
Reviewed-by: Abhijeet Kasurde <None>
(cherry picked from commit 8cc9397)
alinabuzachis pushed a commit to alinabuzachis/amazon.aws that referenced this issue Mar 4, 2022
…ections#691)

ec2_vpc_igw: fix 'NoneType' object is not subscriptable

Depends-On: ansible/ansible-zuul-jobs#1368
SUMMARY
Add "InternetGatewayAttached" waiter
Fixes ansible-collections#647
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
ec2_vpc_igw

Reviewed-by: Alina Buzachis <None>
Reviewed-by: Joseph Torcasso <None>
Reviewed-by: Jill R <None>
Reviewed-by: Abhijeet Kasurde <None>
(cherry picked from commit 8cc9397)
softwarefactory-project-zuul bot pushed a commit that referenced this issue Mar 11, 2022
ec2_vpc_igw: fix 'NoneType' object is not subscriptable (#691)

Manual backport to stable-3: ec2_vpc_igw: fix 'NoneType' object is not subscriptable
SUMMARY
Add "InternetGatewayAttached" waiter
Fixes #647
ISSUE TYPE
Bugfix Pull Request
COMPONENT NAME
ec2_vpc_igw
Reviewed-by: Alina Buzachis 
Reviewed-by: Joseph Torcasso 
Reviewed-by: Jill R 
Reviewed-by: Abhijeet Kasurde 
(cherry picked from commit 8cc9397)
SUMMARY


ISSUE TYPE


Bugfix Pull Request
Docs Pull Request
Feature Pull Request
New Module Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION
softwarefactory-project-zuul bot pushed a commit that referenced this issue Mar 11, 2022
ec2_vpc_igw: fix 'NoneType' object is not subscriptable (#691)

Manual backport to stable-2: ec2_vpc_igw: fix 'NoneType' object is not subscriptable
SUMMARY
Add "InternetGatewayAttached" waiter
Fixes #647
ISSUE TYPE
Bugfix Pull Request
COMPONENT NAME
ec2_vpc_igw
Reviewed-by: Alina Buzachis 
Reviewed-by: Joseph Torcasso 
Reviewed-by: Jill R 
Reviewed-by: Abhijeet Kasurde 
(cherry picked from commit 8cc9397)
SUMMARY


ISSUE TYPE


Bugfix Pull Request
Docs Pull Request
Feature Pull Request
New Module Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION
alinabuzachis pushed a commit to alinabuzachis/amazon.aws that referenced this issue Mar 11, 2022
`ec2_vpc_igw`: fix NoneType error

SUMMARY

use paginator for describe internet gateways and add retry_codes='InvalidInternetGatewayID.NotFound' (thanks @alinabuzachis)
Fixes ansible-collections#647

ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
ec2_vpc_igw
ADDITIONAL INFORMATION

previously added InternetGatewayAttached waiter but problem still persists (ansible-collections#691)

Reviewed-by: Abhijeet Kasurde <None>
Reviewed-by: Jill R <None>
(cherry picked from commit 1965b05)
alinabuzachis pushed a commit to alinabuzachis/amazon.aws that referenced this issue Mar 11, 2022
`ec2_vpc_igw`: fix NoneType error

SUMMARY

use paginator for describe internet gateways and add retry_codes='InvalidInternetGatewayID.NotFound' (thanks @alinabuzachis)
Fixes ansible-collections#647

ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
ec2_vpc_igw
ADDITIONAL INFORMATION

previously added InternetGatewayAttached waiter but problem still persists (ansible-collections#691)

Reviewed-by: Abhijeet Kasurde <None>
Reviewed-by: Jill R <None>
(cherry picked from commit 1965b05)
softwarefactory-project-zuul bot pushed a commit that referenced this issue Mar 18, 2022
`ec2_vpc_igw`: fix NoneType error (#695)

ec2_vpc_igw: fix NoneType error
SUMMARY
use paginator for describe internet gateways and add retry_codes='InvalidInternetGatewayID.NotFound' (thanks @alinabuzachis)
Fixes #647
ISSUE TYPE
Bugfix Pull Request
COMPONENT NAME
ec2_vpc_igw
ADDITIONAL INFORMATION
previously added InternetGatewayAttached waiter but problem still persists (#691)
Reviewed-by: Abhijeet Kasurde 
Reviewed-by: Jill R 
(cherry picked from commit 1965b05)
SUMMARY


ISSUE TYPE


Bugfix Pull Request
Docs Pull Request
Feature Pull Request
New Module Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION
softwarefactory-project-zuul bot pushed a commit that referenced this issue Mar 18, 2022
`ec2_vpc_igw`: fix NoneType error (#695)

ec2_vpc_igw: fix NoneType error
SUMMARY
use paginator for describe internet gateways and add retry_codes='InvalidInternetGatewayID.NotFound' (thanks @alinabuzachis)
Fixes #647
ISSUE TYPE
Bugfix Pull Request
COMPONENT NAME
ec2_vpc_igw
ADDITIONAL INFORMATION
previously added InternetGatewayAttached waiter but problem still persists (#691)
Reviewed-by: Abhijeet Kasurde 
Reviewed-by: Jill R 
(cherry picked from commit 1965b05)
SUMMARY


ISSUE TYPE


Bugfix Pull Request
Docs Pull Request
Feature Pull Request
New Module Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION
@jatorcasso
Copy link
Contributor

I ran into this issue again

@alinabuzachis
Copy link
Contributor

@jatorcasso Where did you hit this error?

@jatorcasso
Copy link
Contributor

@jatorcasso Where did you hit this error?

I got it a few times here and there locally, but also saw it on CI tests https://ansible.softwarefactory-project.io/zuul/build/8e3437bcad9b4099af9dc081dfa70649

@goneri goneri added the CI label Apr 5, 2022
softwarefactory-project-zuul bot pushed a commit that referenced this issue Apr 22, 2022
ec2_vpc_igw - dont user filters to paginate to fix NoneType error

Depends-On: ansible/ansible-zuul-jobs#1498
SUMMARY
Use gateway id when describing gateway instances as opposed to filters if possible to avoid bug of no gateways found.
Fixes #647
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
ec2_vpc_igw

Reviewed-by: Gonéri Le Bouder <[email protected]>
Reviewed-by: Mark Chappell <None>
Reviewed-by: Joseph Torcasso <None>
Reviewed-by: Alina Buzachis <None>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment