|
|
@ -1642,12 +1642,15 @@ def main():
|
|
|
|
module.fail_json(msg='boto required for this module')
|
|
|
|
module.fail_json(msg='boto required for this module')
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
_, ec2_url, aws_connect_kwargs = get_aws_connection_info(module)
|
|
|
|
region, ec2_url, aws_connect_kwargs = get_aws_connection_info(module)
|
|
|
|
if module.params.get('region') or not module.params.get('ec2_url'):
|
|
|
|
if module.params.get('region') or not module.params.get('ec2_url'):
|
|
|
|
ec2 = ec2_connect(module)
|
|
|
|
ec2 = ec2_connect(module)
|
|
|
|
elif module.params.get('ec2_url'):
|
|
|
|
elif module.params.get('ec2_url'):
|
|
|
|
ec2 = connect_ec2_endpoint(ec2_url, **aws_connect_kwargs)
|
|
|
|
ec2 = connect_ec2_endpoint(ec2_url, **aws_connect_kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if 'region' not in aws_connect_kwargs:
|
|
|
|
|
|
|
|
aws_connect_kwargs['region'] = ec2.region
|
|
|
|
|
|
|
|
|
|
|
|
vpc = connect_vpc(**aws_connect_kwargs)
|
|
|
|
vpc = connect_vpc(**aws_connect_kwargs)
|
|
|
|
except boto.exception.NoAuthHandlerFound as e:
|
|
|
|
except boto.exception.NoAuthHandlerFound as e:
|
|
|
|
module.fail_json(msg="Failed to get connection: %s" % e.message, exception=traceback.format_exc())
|
|
|
|
module.fail_json(msg="Failed to get connection: %s" % e.message, exception=traceback.format_exc())
|
|
|
|