mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[cloud] ec2_asg: check autoscaling group for tags before trying to use them - partially fixes #23234 (#23259)
* check autoscaling group for tags before trying to use them * Add warning fix comparison
This commit is contained in:
parent
5f517fdfa9
commit
2f64e2c7fb
1 changed files with 8 additions and 5 deletions
|
@ -551,11 +551,14 @@ def create_autoscaling_group(connection, module):
|
||||||
want_tags[tag.key] = [tag.value, tag.propagate_at_launch]
|
want_tags[tag.key] = [tag.value, tag.propagate_at_launch]
|
||||||
|
|
||||||
dead_tags = []
|
dead_tags = []
|
||||||
|
if getattr(as_group, "tags", None):
|
||||||
for tag in as_group.tags:
|
for tag in as_group.tags:
|
||||||
have_tags[tag.key] = [tag.value, tag.propagate_at_launch]
|
have_tags[tag.key] = [tag.value, tag.propagate_at_launch]
|
||||||
if tag.key not in want_tags:
|
if tag.key not in want_tags:
|
||||||
changed = True
|
changed = True
|
||||||
dead_tags.append(tag)
|
dead_tags.append(tag)
|
||||||
|
elif getattr(as_group, "tags", None) is None and asg_tags:
|
||||||
|
module.warn("It appears your ASG is attached to a target group. This is a boto2 bug. Tags will be added but no tags are able to be removed.")
|
||||||
|
|
||||||
if dead_tags != []:
|
if dead_tags != []:
|
||||||
connection.delete_tags(dead_tags)
|
connection.delete_tags(dead_tags)
|
||||||
|
|
Loading…
Reference in a new issue