From 4cd9933388952440544413696f8fdae24ca58886 Mon Sep 17 00:00:00 2001 From: Casey Lucas Date: Fri, 5 Feb 2016 19:09:54 -0600 Subject: [PATCH] fix edge case where boto returns empty list after subnet creation --- lib/ansible/modules/extras/cloud/amazon/ec2_vpc_subnet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 031f11e1a8..fa07a35364 100644 --- a/lib/ansible/modules/extras/cloud/amazon/ec2_vpc_subnet.py +++ b/lib/ansible/modules/extras/cloud/amazon/ec2_vpc_subnet.py @@ -121,7 +121,7 @@ def get_subnet_info(subnet): def subnet_exists(vpc_conn, subnet_id): filters = {'subnet-id': subnet_id} subnet = vpc_conn.get_all_subnets(filters=filters) - if subnet[0].state == "available": + if subnet and subnet[0].state == "available": return subnet[0] else: return False