예제 #1
0
파일: driver.py 프로젝트: c-mart/rtwo
 def admin_init(cls, id_credentials, prov_credentials):
     """
     To be used instead of settings_init, Expects the following keys for
     each credentials dict:
     id_credentials:
     * Username
     * Password
     * (Tenant/Project) Name
     Prov_credentials:
     * region_name
     * auth_url
     """
     try:
         username = id_credentials.pop('username')
         password = id_credentials.pop('password')
         tenant_name = id_credentials.pop('tenant_name')
     except:
         raise ServiceException(
             'Settings init not available for this class:'
             'Expected settings.OPENSTACK_ARGS with'
             'username/password/tenant_name fields')
     OSProvider.set_meta()
     provider = OSProvider()
     identity = OSIdentity(provider,
                           username,
                           password,
                           ex_tenant_name=tenant_name,
                           **prov_credentials)
     driver = cls(provider, identity)
     return driver
예제 #2
0
 def admin_init(cls, id_credentials, prov_credentials):
     """
     To be used instead of settings_init, Expects the following keys for
     each credentials dict:
     id_credentials:
     * Username
     * Password
     * (Tenant/Project) Name
     Prov_credentials:
     * region_name
     * auth_url
     """
     try:
         username = id_credentials.pop('username')
         password = id_credentials.pop('password')
         tenant_name = id_credentials.pop('tenant_name')
     except:
         raise ServiceException(
             'Settings init not available for this class:'
             'Expected settings.OPENSTACK_ARGS with'
             'username/password/tenant_name fields')
     OSProvider.set_meta()
     provider = OSProvider()
     identity = OSIdentity(provider, username, password,
                           ex_tenant_name=tenant_name,
                           **prov_credentials)
     driver = cls(provider, identity)
     return driver
 def _build_admin_driver(self, **kwargs):
     #Set Meta
     OSProvider.set_meta()
     #TODO: Set location from kwargs
     provider = OSProvider(identifier=kwargs.get('location'))
     admin_creds = self._admin_identity_creds(**kwargs)
     #logger.info("ADMINID Creds:%s" % admin_creds)
     identity = OSIdentity(provider, **admin_creds)
     driver_creds = self._admin_driver_creds(**kwargs)
     #logger.info("ADMINDriver Creds:%s" % driver_creds)
     admin_driver = OSDriver(provider, identity, **driver_creds)
     return admin_driver
예제 #4
0
 def _build_admin_driver(self, **kwargs):
     #Set Meta
     OSProvider.set_meta()
     #TODO: Set location from kwargs
     provider = OSProvider(identifier=kwargs.get('location'))
     admin_creds = self._admin_identity_creds(**kwargs)
     #logger.info("ADMINID Creds:%s" % admin_creds)
     identity = OSIdentity(provider, **admin_creds)
     driver_creds = self._admin_driver_creds(**kwargs)
     #logger.info("ADMINDriver Creds:%s" % driver_creds)
     admin_driver = OSDriver(provider, identity, **driver_creds)
     return admin_driver
예제 #5
0
 def settings_init(cls):
     """
     DEPRECATED:
     """
     os_args = {}
     try:
         username = os_args.pop('username')
         password = os_args.pop('password')
         tenant_name = os_args.pop('tenant_name')
     except:
         raise ServiceException(
             'Settings init not available for this class:'
             'Expected settings.OPENSTACK_ARGS with'
             'username/password/tenant_name fields')
     OSProvider.set_meta()
     provider = OSProvider()
     identity = OSIdentity(provider, username, password,
                           ex_tenant_name=tenant_name)
     driver = cls(provider, identity)
     return driver
예제 #6
0
파일: driver.py 프로젝트: c-mart/rtwo
 def settings_init(cls):
     """
     DEPRECATED:
     """
     os_args = {}
     try:
         username = os_args.pop('username')
         password = os_args.pop('password')
         tenant_name = os_args.pop('tenant_name')
     except:
         raise ServiceException(
             'Settings init not available for this class:'
             'Expected settings.OPENSTACK_ARGS with'
             'username/password/tenant_name fields')
     OSProvider.set_meta()
     provider = OSProvider()
     identity = OSIdentity(provider,
                           username,
                           password,
                           ex_tenant_name=tenant_name)
     driver = cls(provider, identity)
     return driver
예제 #7
0
 def create_admin_driver(self, creds=None):
     """
     DEPRECATED
     """
     admin_provider = OSProvider()
     provider_creds = self.provider_options
     key, secret, tenant =\
         self._split_creds(creds,
                           '',
                           '',
                           '')
     admin_identity = OSIdentity(admin_provider,
                                 key,
                                 secret,
                                 ex_tenant_name=tenant)
     admin_driver = OSDriver(admin_provider, admin_identity,
                             **provider_creds)
     return admin_driver
예제 #8
0
                auth_url, auth_token,
                project_name, domain_name)
        else:
            username = all_creds.get('key','')
            password = all_creds.get('secret','')
            (auth, sess, token) = _connect_to_keystone_v3(
                auth_url, username, password,
                project_name, domain_name=domain_name)
        network_driver = NetworkManager(session=sess)
        return network_driver


#TODO: Remove these ASAP -- Once we determine it will not be a problem.
EucaProvider.set_meta()
AWSProvider.set_meta()
OSProvider.set_meta()

from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver as fetch_driver


PROVIDER_DEFAULTS = {
    "openstack": {
        "secure": False,
        "ex_force_auth_version": "2.0_password"
    }
}


def create_libcloud_driver(identity, provider_type=Provider.OPENSTACK):
    user = identity.created_by
예제 #9
0
                auth_url, auth_token,
                project_name, domain_name)
        else:
            username = all_creds.get('key','')
            password = all_creds.get('secret','')
            (auth, sess, token) = _connect_to_keystone_v3(
                auth_url, username, password,
                project_name, domain_name=domain_name)
        network_driver = NetworkManager(session=sess)
        return network_driver


#TODO: Remove these ASAP -- Once we determine it will not be a problem.
EucaProvider.set_meta()
AWSProvider.set_meta()
OSProvider.set_meta()

from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver as fetch_driver


PROVIDER_DEFAULTS = {
    "openstack": {
        "secure": False,
        "ex_force_auth_version": "2.0_password"
    }
}


def create_libcloud_driver(identity, provider_type=Provider.OPENSTACK):
    user = identity.created_by