From 2957b80bcf0641306c18649c65957b2c8c1b6ac2 Mon Sep 17 00:00:00 2001 From: Tim Gerla Date: Tue, 22 Jan 2013 14:10:21 -0800 Subject: [PATCH] use connect_ec2_endpoint instead of connect_euca, and properly pass keys to connect_ec2 --- ec2 | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/ec2 b/ec2 index eadec94436a..2e5c3996510 100644 --- a/ec2 +++ b/ec2 @@ -98,7 +98,6 @@ author: Seth Vidal import boto import time -from urlparse import urlparse def main(): module = AnsibleModule( @@ -139,15 +138,10 @@ def main(): if not ec2_access_key and 'EC2_ACCESS_KEY' in os.environ: ec2_access_key = os.environ['EC2_ACCESS_KEY'] - if ec2_url: # if we have an URL set, assume Eucalyptus - url = urlparse(ec2_url) - ec2 = boto.connect_euca(host = url.netloc.split(":")[0], - aws_access_key_id = ec2_access_key, - aws_secret_access_key = ec2_secret_key, - port = url.port, - path = url.path) + if ec2_url: # if we have an URL set, connect to the specified endpoint + ec2 = boto.connect_ec2_endpoint(ec2_url, ec2_access_key, ec2_secret_key) else: # otherwise it's Amazon. - ec2 = boto.connect_ec2() + ec2 = boto.connect_ec2(ec2_access_key, ec2_secret_key) try: res = ec2.run_instances(image, key_name = key_name,