use connect_ec2_endpoint instead of connect_euca, and properly pass keys to connect_ec2

pull/1911/head
Tim Gerla 12 years ago
parent 456e6f5a55
commit 139aee58e2

@ -98,7 +98,6 @@ author: Seth Vidal
import boto import boto
import time import time
from urlparse import urlparse
def main(): def main():
module = AnsibleModule( module = AnsibleModule(
@ -139,15 +138,10 @@ def main():
if not ec2_access_key and 'EC2_ACCESS_KEY' in os.environ: if not ec2_access_key and 'EC2_ACCESS_KEY' in os.environ:
ec2_access_key = os.environ['EC2_ACCESS_KEY'] ec2_access_key = os.environ['EC2_ACCESS_KEY']
if ec2_url: # if we have an URL set, assume Eucalyptus if ec2_url: # if we have an URL set, connect to the specified endpoint
url = urlparse(ec2_url) ec2 = boto.connect_ec2_endpoint(ec2_url, ec2_access_key, ec2_secret_key)
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)
else: # otherwise it's Amazon. else: # otherwise it's Amazon.
ec2 = boto.connect_ec2() ec2 = boto.connect_ec2(ec2_access_key, ec2_secret_key)
try: try:
res = ec2.run_instances(image, key_name = key_name, res = ec2.run_instances(image, key_name = key_name,

Loading…
Cancel
Save