Woops, make collect/delete loop more efficient.

This commit is contained in:
moe 2015-02-04 06:13:52 +01:00 committed by Matt Clay
parent 5e1e1a4dff
commit bd09ebe5b4

View file

@ -412,15 +412,15 @@ def create_autoscaling_group(connection, module):
for tag in asg_tags: for tag in asg_tags:
want_tags[tag.key] = [tag.value, tag.propagate_at_launch] want_tags[tag.key] = [tag.value, tag.propagate_at_launch]
dead_tags = []
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]
dead_tags = []
if not tag.key in want_tags: if not tag.key in want_tags:
changed = True changed = True
dead_tags.append(tag) dead_tags.append(tag)
if dead_tags != []: if dead_tags != []:
connection.delete_tags(dead_tags) connection.delete_tags(dead_tags)
if have_tags != want_tags: if have_tags != want_tags:
changed = True changed = True