def __init__(self): Ec2Platform.__init__(self) self._logger = logging.getLogger(__name__) cnf = bus.cnf cnf.explore_key(CLOUD_CERT, 'Eucalyptus cloud certificate', private=False)
def set_access_data(self, access_data): ''' Eucalyptus cloud_cert, ec2_url, s3_url may be passed within access data. Accept them if they are not precented in configuration ''' cnf = bus.cnf; ini = cnf.rawini if not os.path.exists(cnf.key_path(CLOUD_CERT, private=False)): cnf.write_key(CLOUD_CERT, access_data[OPT_CLOUD_CERT], private=False) if not ini.has_section(SECTION) or not ini.has_option(SECTION, OPT_EC2_URL): cnf.update_ini(self.name, {self.name: { OPT_S3_URL : access_data[OPT_S3_URL], OPT_EC2_URL : access_data[OPT_EC2_URL] }}) Ec2Platform.set_access_data(self, access_data)
def test_metadata(self): platform = Ec2Platform() platform._meta_url = "http://localhost:9999/" self.assertEqual('i-12345678', platform.get_instance_id()) self.assertEqual('ami-12345678', platform.get_ami_id()) self.assertEqual("value", platform.get_user_data("key")) self.assertEqual("another_value", platform.get_user_data("another_key")) self.assertEqual("123.123.123.123", platform.get_private_ip()) self.assertEqual("1.1.1.1", platform.get_public_ip()) self.assertTrue("1.1.1.1" in platform._metadata.values())
def set_access_data(self, access_data): ''' Eucalyptus cloud_cert, ec2_url, s3_url may be passed within access data. Accept them if they are not precented in configuration ''' cnf = bus.cnf ini = cnf.rawini if not os.path.exists(cnf.key_path(CLOUD_CERT, private=False)): cnf.write_key(CLOUD_CERT, access_data[OPT_CLOUD_CERT], private=False) if not ini.has_section(SECTION) or not ini.has_option( SECTION, OPT_EC2_URL): cnf.update_ini( self.name, { self.name: { OPT_S3_URL: access_data[OPT_S3_URL], OPT_EC2_URL: access_data[OPT_EC2_URL] } }) Ec2Platform.set_access_data(self, access_data)