From 5741712a096a6cbec87fa1cf468765c68b60303f Mon Sep 17 00:00:00 2001 From: Will Thames Date: Thu, 18 May 2017 23:34:53 +1000 Subject: [PATCH] ec2_group_facts tag list should have case preserved (#24760) Tags should retain case, and should not be snake cased. Easiest way to do this is to snake before converting tag list as while that affects the keys of the boto3 tag lists, it doesn't affect the values. Need to use `tag_value_key_name` and `tag_name_key_name` following recent change to `boto3_tag_list_to_ansible_dict`, which used to handle both `key`/`Key` and `value`/`Value` --- lib/ansible/modules/cloud/amazon/ec2_group_facts.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/ec2_group_facts.py b/lib/ansible/modules/cloud/amazon/ec2_group_facts.py index 55ca81219d4..026274573fc 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_group_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_group_facts.py @@ -153,11 +153,13 @@ def main(): except ClientError as e: module.fail_json(msg=e.message, exception=traceback.format_exc()) - # Modify boto3 tags list to be ansible friendly dict and then camel_case snaked_security_groups = [] for security_group in security_groups['SecurityGroups']: - security_group['Tags'] = boto3_tag_list_to_ansible_dict(security_group['Tags']) - snaked_security_groups.append(camel_dict_to_snake_dict(security_group)) + # Modify boto3 tags list to be ansible friendly dict + # but don't camel case tags + security_group = camel_dict_to_snake_dict(security_group) + security_group['tags'] = boto3_tag_list_to_ansible_dict(security_group['tags'], tag_name_key_name='key', tag_value_key_name='value') + snaked_security_groups.append(security_group) module.exit_json(security_groups=snaked_security_groups)