Skip to content

Commit

Permalink
ec2_group_facts tag list should have case preserved (ansible#24760)
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
willthames authored and ansibot committed May 18, 2017
1 parent feafae7 commit 5741712
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/ansible/modules/cloud/amazon/ec2_group_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 5741712

Please sign in to comment.