From bd09ebe5b4e76939a54f5b7ecb0d694f0d911ccc Mon Sep 17 00:00:00 2001 From: moe Date: Wed, 4 Feb 2015 06:13:52 +0100 Subject: [PATCH] Woops, make collect/delete loop more efficient. --- lib/ansible/modules/cloud/amazon/ec2_asg.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/ec2_asg.py b/lib/ansible/modules/cloud/amazon/ec2_asg.py index 65c17640994..7602efdd7bd 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_asg.py +++ b/lib/ansible/modules/cloud/amazon/ec2_asg.py @@ -412,15 +412,15 @@ def create_autoscaling_group(connection, module): for tag in asg_tags: want_tags[tag.key] = [tag.value, tag.propagate_at_launch] + dead_tags = [] for tag in as_group.tags: have_tags[tag.key] = [tag.value, tag.propagate_at_launch] - dead_tags = [] if not tag.key in want_tags: changed = True dead_tags.append(tag) - if dead_tags != []: - connection.delete_tags(dead_tags) + if dead_tags != []: + connection.delete_tags(dead_tags) if have_tags != want_tags: changed = True