From f3865e370c9e698d81f0650459525378e8940f2f Mon Sep 17 00:00:00 2001 From: Wolfgang Felbermeier Date: Tue, 19 Sep 2017 02:09:56 +0200 Subject: [PATCH] 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 --- lib/ansible/modules/cloud/amazon/ec2_instance_facts.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/ec2_instance_facts.py b/lib/ansible/modules/cloud/amazon/ec2_instance_facts.py index 692f10c65b8..ce99744b7e4 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_instance_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_instance_facts.py @@ -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)