summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby Calderwood <bobby@b23.io>2015-04-21 14:56:46 -0400
committerToshio Kuratomi <toshio@fedoraproject.org>2015-07-08 06:08:31 -0700
commitf995acf51e8dcbe026bb104a5bacb5af648d91d5 (patch)
treec7f9fd3280f45d675ae4e465b855574d6a872753
parenta64270badc6bb4f6a506f37af632ca255215ad5f (diff)
downloadansible-modules-core-f995acf51e8dcbe026bb104a5bacb5af648d91d5.tar.gz
Fixes regression introduced by edf1ac1ea6ffd5d44bb2bb62ad320364baf310a3
-rw-r--r--cloud/amazon/ec2_vpc.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/cloud/amazon/ec2_vpc.py b/cloud/amazon/ec2_vpc.py
index a4f7c0ad..af11a965 100644
--- a/cloud/amazon/ec2_vpc.py
+++ b/cloud/amazon/ec2_vpc.py
@@ -506,14 +506,15 @@ def create_vpc(module, vpc_conn):
'id': sn.id,
})
- # Sort subnets by the order they were listed in the play
- order = {}
- for idx, val in enumerate(subnets):
- order[val['cidr']] = idx
-
- # Number of subnets in the play
- subnets_in_play = len(subnets)
- returned_subnets.sort(key=lambda x: order.get(x['cidr'], subnets_in_play))
+ if subnets is not None:
+ # Sort subnets by the order they were listed in the play
+ order = {}
+ for idx, val in enumerate(subnets):
+ order[val['cidr']] = idx
+
+ # Number of subnets in the play
+ subnets_in_play = len(subnets)
+ returned_subnets.sort(key=lambda x: order.get(x['cidr'], subnets_in_play))
return (vpc_dict, created_vpc_id, returned_subnets, changed)