From 46ea3155c6133212870b1095f327ddb730a2635d Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Mon, 14 Apr 2014 10:58:07 -0500 Subject: [PATCH] Ensure params were set in ec2_vpc before accessing them Fixes #6763 --- library/cloud/ec2_vpc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/cloud/ec2_vpc b/library/cloud/ec2_vpc index 44d207b3896..1b0d6745ae7 100644 --- a/library/cloud/ec2_vpc +++ b/library/cloud/ec2_vpc @@ -328,7 +328,7 @@ def create_vpc(module, vpc_conn): # Process all subnet properties - if not isinstance(subnets, list): + if subnets and not isinstance(subnets, list): module.fail_json(msg='subnets needs to be a list of cidr blocks') current_subnets = vpc_conn.get_all_subnets(filters={ 'vpc_id': vpc.id }) @@ -405,7 +405,7 @@ def create_vpc(module, vpc_conn): # think of without using painful aws ids. Hopefully boto will add # the replace-route-table API to make this smoother and # allow control of the 'main' routing table. - if not isinstance(route_tables, list): + if route_tables and not isinstance(route_tables, list): module.fail_json(msg='route tables need to be a list of dictionaries') # Work through each route table and update/create to match dictionary array