Fix tags in ec2_instance_facts (#30333)

* Fix tags in ec2_instance_facts
The method boto3_tag_list_to_ansible_dict in module_utils/ec2.py changed
and does no longer check whether the returned result of boto3 uses
"key" or "Key" as the tag key identifier.
This fixes ec2_instance_facts to make this check in its own, since boto3
may return "key" instead of "Key"

* Since the indices for the tags are already formatted to lowercase
by the snaking, we can assume, that the index for the tags are already
formatted
pull/4420/head
Wolfgang Felbermeier 2017-09-19 02:09:56 +02:00 committed by Will Thames
parent 9da5f542cc
commit f3865e370c
1 changed files with 1 additions and 2 deletions

View File

@ -500,8 +500,7 @@ def list_ec2_instances(connection, module):
# Turn the boto3 result in to ansible friendly tag dictionary
for instance in snaked_instances:
if 'tags' in instance:
instance['tags'] = boto3_tag_list_to_ansible_dict(instance['tags'])
instance['tags'] = boto3_tag_list_to_ansible_dict(instance.get('tags', []), 'key', 'value')
module.exit_json(instances=snaked_instances)