1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Avoid KeyError when subnet['Tags'] doesn't exist (#30349)

The problem was introduced in 2cdf31d3.
This commit is contained in:
Abhijit Menon-Sen 2017-09-14 17:00:09 +05:30 committed by Will Thames
parent 4c9ad00c50
commit 524c5dcfef

View file

@ -215,7 +215,7 @@ def describe_subnets(connection, module):
subnet['id'] = subnet['SubnetId'] subnet['id'] = subnet['SubnetId']
subnet_info.append(camel_dict_to_snake_dict(subnet)) subnet_info.append(camel_dict_to_snake_dict(subnet))
# convert tag list to ansible dict # convert tag list to ansible dict
subnet_info[-1]['tags'] = boto3_tag_list_to_ansible_dict(subnet['Tags']) subnet_info[-1]['tags'] = boto3_tag_list_to_ansible_dict(subnet.get('Tags', []))
module.exit_json(subnets=subnet_info) module.exit_json(subnets=subnet_info)