You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
The text was updated successfully, but these errors were encountered:
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.
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
COMPONENT NAME
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: