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

Allow removal of target groups from ASGs (#25126)

An empty `target_group_arns` list represents no target groups.
This is different to not passing a `target_group_arns` list at all
which can signify no change.

Remove unnecessary empty list construction, as it must already be
an empty list to get to that point.
This commit is contained in:
Will Thames 2017-06-01 22:53:31 +10:00 committed by Sloane Hertel
parent aa9ea3d43a
commit 3ca006ecbb

View file

@ -694,10 +694,8 @@ def create_autoscaling_group(connection, module):
module.fail_json(msg="Failed to update Autoscaling Group.", module.fail_json(msg="Failed to update Autoscaling Group.",
exception=traceback.format_exc(), **camel_dict_to_snake_dict(e.response)) exception=traceback.format_exc(), **camel_dict_to_snake_dict(e.response))
# Update target groups if they are specified and one or more already exists # Update target groups if they are specified and one or more already exists
elif target_group_arns and as_group['TargetGroupARNs']: elif target_group_arns is not None and as_group['TargetGroupARNs']:
# Get differences # Get differences
if not target_group_arns:
target_group_arns = list()
wanted_tgs = set(target_group_arns) wanted_tgs = set(target_group_arns)
has_tgs = set(as_group['TargetGroupARNs']) has_tgs = set(as_group['TargetGroupARNs'])
# check if all requested are already existing # check if all requested are already existing