From 6670f7a2206536b6560ba4a81d0e6a1687bd2a95 Mon Sep 17 00:00:00 2001 From: Robert Estelle Date: Wed, 3 Dec 2014 13:24:54 -0500 Subject: [PATCH] ec2_vpc_subnet - Use dict constructor instead of comprehension. --- lib/ansible/modules/extras/cloud/amazon/ec2_vpc_subnet.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/extras/cloud/amazon/ec2_vpc_subnet.py b/lib/ansible/modules/extras/cloud/amazon/ec2_vpc_subnet.py index 5c7fc8596a2..d4d37da874c 100644 --- a/lib/ansible/modules/extras/cloud/amazon/ec2_vpc_subnet.py +++ b/lib/ansible/modules/extras/cloud/amazon/ec2_vpc_subnet.py @@ -162,8 +162,8 @@ def create_subnet(vpc_conn, vpc_id, cidr, az): def get_resource_tags(vpc_conn, resource_id): - return {t.name: t.value for t in - vpc_conn.get_all_tags(filters={'resource-id': resource_id})} + return dict((t.name, t.value) for t in + vpc_conn.get_all_tags(filters={'resource-id': resource_id})) def ensure_tags(vpc_conn, resource_id, tags, add_only, dry_run): @@ -172,11 +172,11 @@ def ensure_tags(vpc_conn, resource_id, tags, add_only, dry_run): if cur_tags == tags: return {'changed': False, 'tags': cur_tags} - to_delete = {k: cur_tags[k] for k in cur_tags if k not in tags} + to_delete = dict((k, cur_tags[k]) for k in cur_tags if k not in tags) if to_delete and not add_only: vpc_conn.delete_tags(resource_id, to_delete, dry_run=dry_run) - to_add = {k: tags[k] for k in tags if k not in cur_tags} + to_add = dict((k, tags[k]) for k in tags if k not in cur_tags) if to_add: vpc_conn.create_tags(resource_id, to_add, dry_run=dry_run)