def __init__(self, profile):
     UpgradeTestBackend.__init__(self, profile)
     self.profiledir = os.path.dirname(profile)
     # get ssh key name
     self.ssh_key = os.path.abspath(
         self.config.getWithDefault(
             "NonInteractive",
             "SSHKey",
             "/var/cache/auto-upgrade-tester/ssh-key")
         )
     if not os.path.exists(self.ssh_key):
         print "Creating key: %s" % self.ssh_key
         subprocess.call(["ssh-keygen","-N","","-f",self.ssh_key])
    def __init__(self, profile):
        UpgradeTestBackend.__init__(self, profile)
        self.profiledir = os.path.abspath(os.path.dirname(profile))
        # ami base name (e.g .ami-44bb5c2d)
        self.ec2ami = self.config.get("EC2","AMI")
        self.ssh_key = self.config.get("EC2","SSHKey")
        try:
            self.access_key_id = (os.getenv("AWS_ACCESS_KEY_ID") or
                                  self.config.get("EC2","access_key_id"))
            self.secret_access_key = (os.getenv("AWS_SECRET_ACCESS_KEY") or
                                      self.config.get("EC2","secret_access_key"))
        except ConfigParser.NoOptionError:
            print "Either export AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY or"
            print "set access_key_id and secret_access_key in the profile config"
            print "file."
            sys.exit(1)
        self._conn = EC2Connection(self.access_key_id, self.secret_access_key)
        self.ubuntu_official_ami = False
        if self.config.has_option("EC2","UbuntuOfficialAMI"):
            self.ubuntu_official_ami = self.config.getboolean("EC2","UbuntuOfficialAMI")
        
        try:
            self.security_groups = self.config.getlist("EC2","SecurityGroups")
        except ConfigParser.NoOptionError:
            self.security_groups = []

        if self.ssh_key.startswith("./"):
            self.ssh_key = self.profiledir + self.ssh_key[1:]
        self.ssh_port = "22"
        self.instance = None

        # the public name of the instance, e.g. 
        #  ec2-174-129-152-83.compute-1.amazonaws.com
        self.ssh_hostname = ""
        # the instance name (e.g. i-3325ad4)
        self.ec2instance = ""
        if (self.config.has_option("NonInteractive","RealReboot") and
            self.config.getboolean("NonInteractive","RealReboot")):
            raise OptionError, "NonInteractive/RealReboot option must be set to False for the ec2 upgrader"
        atexit.register(self._cleanup)
 def __init__(self, profile):
     UpgradeTestBackend.__init__(self, profile)
     self.tarball = None