From 85ddb1b90232dbd68798e9b2d7dafa5689a1d30e Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Thu, 20 Aug 2015 17:32:05 -0400 Subject: [PATCH] Fixing region requirement regarding euca clusters Fixes ansible/ansible#11023 --- cloud/amazon/ec2.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cloud/amazon/ec2.py b/cloud/amazon/ec2.py index 55c45a647f4..c2b57eb7cd3 100644 --- a/cloud/amazon/ec2.py +++ b/cloud/amazon/ec2.py @@ -824,7 +824,10 @@ def create_instances(module, ec2, vpc, override_count=None): vpc_id = None if vpc_subnet_id: - vpc_id = vpc.get_all_subnets(subnet_ids=[vpc_subnet_id])[0].vpc_id + if not vpc: + module.fail_json(msg="region must be specified") + else: + vpc_id = vpc.get_all_subnets(subnet_ids=[vpc_subnet_id])[0].vpc_id else: vpc_id = None @@ -1281,7 +1284,7 @@ def main(): except boto.exception.NoAuthHandlerFound, e: module.fail_json(msg = str(e)) else: - module.fail_json(msg="region must be specified") + vpc = None tagged_instances = []