def _fixxpath(self, xpath): # old (pre 2.7) Nimbus return types don't include namespace declaration in every # tag, unlike EC2. So we override this method to make xpath queries # just pass through instead of being ns-prefixed. if self.fix_xpath: return EC2NodeDriver._fixxpath(self, xpath) else: return xpath
def start(self): "Fire up a fresh EC2 instance." EC2 = get_driver(Provider.EC2) self.driver = EC2NodeDriver(settings.id, settings.key) image = NodeImage(self.ec2_ami, self.ec2_ami, EC2) size = NodeSize(self.ec2_mtype, self.ec2_mtype, None, None, None, None, EC2) self.node = self.driver.create_node(image=image, name=self.ec2_ami, size=size, keyname=self.ec2_sshkey, securitygroup=self.ec2_groups) print "Created node %s" % self.node.id
def __init__(self, *args, **kwargs): self.fix_xpath = not kwargs.pop('ex_oldnimbus_xml', False) EC2NodeDriver.__init__(self, *args, **kwargs)
# libcloud's SSH client seems to be one of those pointless wrappers # that (at the moment) both doesn't add anything to the thing it wraps # (Paramiko) and also fails to expose the underlying thing's features. # What's wrong with people? #from libcloud.ssh import SSHClient import time import sys import settings import subprocess import os import socket EC2 = get_driver(Provider.EC2) EC2Driver=EC2NodeDriver(settings.id, settings.key) def tryEC2(): image=NodeImage('ami-bf07ead6', 'ubuntu 10.4', EC2) size=NodeSize('m1.large', 'large', None, None, None, None, EC2) node = None try: node = EC2Driver.create_node(image=image, name="ubuntu-test", size=size, keyname="kp1", securitygroup=['default', 'dist-slave', 'buildbot-slave']) print node print node.id while node.state == NodeState.PENDING: time.sleep(3) finally: if node: