コード例 #1
0
    def __init__(self):
        Ec2Platform.__init__(self)
        self._logger = logging.getLogger(__name__)

        cnf = bus.cnf
        cnf.explore_key(CLOUD_CERT,
                        'Eucalyptus cloud certificate',
                        private=False)
コード例 #2
0
ファイル: eucalyptus.py プロジェクト: AnyBucket/scalarizr
    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)
コード例 #3
0
 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())
コード例 #4
0
    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)
コード例 #5
0
ファイル: eucalyptus.py プロジェクト: AnyBucket/scalarizr
    def __init__(self):
        Ec2Platform.__init__(self)
        self._logger = logging.getLogger(__name__)

        cnf = bus.cnf
        cnf.explore_key(CLOUD_CERT, 'Eucalyptus cloud certificate', private=False)