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

ec2_transit_gateway error with gateway has no "Description" key #68

Closed
fortinetps opened this issue May 12, 2020 · 2 comments
Closed

ec2_transit_gateway error with gateway has no "Description" key #68

fortinetps opened this issue May 12, 2020 · 2 comments

Comments

@fortinetps
Copy link

SUMMARY

When I was trying to create a TGW, ec2_transit_gateway module return error and failed to create one. I captured the error messages below. Which is about line#340, module exams each gateway from the return, and checks the "Description" and "State". But it turns out in my case, the "Description" key doesn't exist.

I simply change #340 from directly access the "Description" key to use get() function,
if description == gateway.get('Description','') and gateway['State'] != 'deleted':
This workaround solved my problem.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
ANSIBLE VERSION
ansible 2.10.0.dev0
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.7.7 (default, Apr 23 2020, 15:05:00) [GCC 6.3.0 20170516]
# /root/.ansible/collections/ansible_collections
Collection        Version
----------------- -------
amazon.aws        0.1.1  
ansible.netcommon 0.0.2  
community.aws     0.1.0  
CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS
The full traceback is:
Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-tmp-1589245545.3153915-20091-254377192640234/AnsiballZ_ec2_transit_gateway.py", line 102, in <module>
    _ansiballz_main()
  File "/root/.ansible/tmp/ansible-tmp-1589245545.3153915-20091-254377192640234/AnsiballZ_ec2_transit_gateway.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/root/.ansible/tmp/ansible-tmp-1589245545.3153915-20091-254377192640234/AnsiballZ_ec2_transit_gateway.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.community.aws.plugins.modules.ec2_transit_gateway', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/local/lib/python3.7/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/local/lib/python3.7/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_community.aws.ec2_transit_gateway_payload_7by178pi/ansible_community.aws.ec2_transit_gateway_payload.zip/ansible_collections/community/aws/plugins/modules/ec2_transit_gateway.py", line 578, in <module>
  File "/tmp/ansible_community.aws.ec2_transit_gateway_payload_7by178pi/ansible_community.aws.ec2_transit_gateway_payload.zip/ansible_collections/community/aws/plugins/modules/ec2_transit_gateway.py", line 572, in main
  File "/tmp/ansible_community.aws.ec2_transit_gateway_payload_7by178pi/ansible_community.aws.ec2_transit_gateway_payload.zip/ansible_collections/community/aws/plugins/modules/ec2_transit_gateway.py", line 270, in process
  File "/tmp/ansible_community.aws.ec2_transit_gateway_payload_7by178pi/ansible_community.aws.ec2_transit_gateway_payload.zip/ansible_collections/community/aws/plugins/modules/ec2_transit_gateway.py", line 480, in ensure_tgw_present
  File "/tmp/ansible_community.aws.ec2_transit_gateway_payload_7by178pi/ansible_community.aws.ec2_transit_gateway_payload.zip/ansible_collections/community/aws/plugins/modules/ec2_transit_gateway.py", line 340, in get_matching_tgw
KeyError: 'Description'
fatal: [us-east-2-vpc01]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1589245545.3153915-20091-254377192640234/AnsiballZ_ec2_transit_gateway.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1589245545.3153915-20091-254377192640234/AnsiballZ_ec2_transit_gateway.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1589245545.3153915-20091-254377192640234/AnsiballZ_ec2_transit_gateway.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.community.aws.plugins.modules.ec2_transit_gateway', init_globals=None, run_name='__main__', alter_sys=True)\n  File \"/usr/local/lib/python3.7/runpy.py\", line 205, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/local/lib/python3.7/runpy.py\", line 96, in _run_module_code\n    mod_name, mod_spec, pkg_name, script_name)\n  File \"/usr/local/lib/python3.7/runpy.py\", line 85, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_community.aws.ec2_transit_gateway_payload_7by178pi/ansible_community.aws.ec2_transit_gateway_payload.zip/ansible_collections/community/aws/plugins/modules/ec2_transit_gateway.py\", line 578, in <module>\n  File \"/tmp/ansible_community.aws.ec2_transit_gateway_payload_7by178pi/ansible_community.aws.ec2_transit_gateway_payload.zip/ansible_collections/community/aws/plugins/modules/ec2_transit_gateway.py\", line 572, in main\n  File \"/tmp/ansible_community.aws.ec2_transit_gateway_payload_7by178pi/ansible_community.aws.ec2_transit_gateway_payload.zip/ansible_collections/community/aws/plugins/modules/ec2_transit_gateway.py\", line 270, in process\n  File \"/tmp/ansible_community.aws.ec2_transit_gateway_payload_7by178pi/ansible_community.aws.ec2_transit_gateway_payload.zip/ansible_collections/community/aws/plugins/modules/ec2_transit_gateway.py\", line 480, in ensure_tgw_present\n  File \"/tmp/ansible_community.aws.ec2_transit_gateway_payload_7by178pi/ansible_community.aws.ec2_transit_gateway_payload.zip/ansible_collections/community/aws/plugins/modules/ec2_transit_gateway.py\", line 340, in get_matching_tgw\nKeyError: 'Description'\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
@ansibullbot
Copy link

Files identified in the description:
None

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

@tremble
Copy link
Contributor

tremble commented Jul 9, 2022

I've attempted to reproduce this issue and have not managed to do so. Looking at the botocore history Description was added in botocore 1.12.52 and should always be returned.

Since release 2.0.0 of these collections we've dropped support for botocore < 1.18.0 and as such this issue should not be a problem for currently supported releases of this collection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants