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

[cloud] ec2_group: fix check mode when using tags (#36503)

Fixes #36412
This commit is contained in:
Julien Vey 2018-02-21 20:48:51 +01:00 committed by Ryan Brown
parent 51ba115dea
commit a77b89e7b5

View file

@ -789,10 +789,11 @@ def main():
changed = True
if tags is not None:
if tags is not None and group is not None:
current_tags = boto3_tag_list_to_ansible_dict(group.get('Tags', []))
tags_need_modify, tags_to_delete = compare_aws_tags(current_tags, tags, purge_tags)
if tags_to_delete:
if not module.check_mode:
try:
client.delete_tags(Resources=[group['GroupId']], Tags=[{'Key': tag} for tag in tags_to_delete])
except botocore.exceptions.ClientError as e:
@ -801,6 +802,7 @@ def main():
# Add/update tags
if tags_need_modify:
if not module.check_mode:
try:
client.create_tags(Resources=[group['GroupId']], Tags=ansible_dict_to_boto3_tag_list(tags_need_modify))
except botocore.exceptions.ClientError as e: