def create_nova_volume_client(context): # Quite annoying but due to a paste config loading bug. # TODO(hub-cap): talk to the openstack-common people about this PROXY_ADMIN_USER = CONFIG.get('reddwarf_proxy_admin_user', 'admin') PROXY_ADMIN_PASS = CONFIG.get('reddwarf_proxy_admin_pass', '3de4922d8b6ac5a1aad9') PROXY_ADMIN_TENANT_NAME = CONFIG.get('reddwarf_proxy_admin_tenant_name', 'admin') PROXY_AUTH_URL = CONFIG.get('reddwarf_auth_url', 'http://0.0.0.0:5000/v2.0') REGION_NAME = CONFIG.get('nova_region_name', 'RegionOne') SERVICE_TYPE = CONFIG.get('nova_volume_service_type', 'volume') SERVICE_NAME = CONFIG.get('nova_volume_service_name', 'Volume Service') #TODO(cp16net) need to fix this proxy_tenant_id client = Client(PROXY_ADMIN_USER, PROXY_ADMIN_PASS, PROXY_ADMIN_TENANT_NAME, PROXY_AUTH_URL, proxy_tenant_id=context.tenant, proxy_token=context.auth_tok, region_name=REGION_NAME, service_type=SERVICE_TYPE, service_name=SERVICE_NAME) client.authenticate() return client
def get_client(cls, credential, region=None): # Quite annoying but due to a paste config loading bug. # TODO(hub-cap): talk to the openstack-common people about this #PROXY_ADMIN_USER = CONFIG.get('reddwarf_proxy_admin_user', 'admin') #PROXY_ADMIN_PASS = CONFIG.get('reddwarf_proxy_admin_pass', # '3de4922d8b6ac5a1aad9') #PROXY_ADMIN_TENANT_NAME = CONFIG.get( # 'reddwarf_proxy_admin_tenant_name', # 'admin') PROXY_AUTH_URL = CONFIG.get('reddwarf_auth_url', 'http://0.0.0.0:5000/v2.0') # PROXY_AUTH_URL = 'https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/' if region is None: region = 'az-2.region-a.geo-1' try: client = Client(credential['user_name'], credential['password'], credential['tenant_id'], PROXY_AUTH_URL, #proxy_tenant_id=context.tenant, #proxy_token=context.auth_tok, region_name=region, #service_type='compute', service_name="Compute") client.authenticate() except Exception: LOG.exception("Error authenticating with Novaclient") return client
def create_nova_client(user, service_type="nova_service_type"): """Creates a rich client for the Nova API using the test config.""" test_config.nova.ensure_started() openstack = Client(user.auth_user, user.auth_key, user.tenant, test_config.nova_auth_url, service_type=test_config.values[service_type]) openstack.authenticate() return TestClient(openstack)
def create_nova_client(user, service_type=None): """Creates a rich client for the Nova API using the test config.""" if test_config.nova_client is None: raise SkipTest("No nova_client info specified in the Test Config " "so this test will be skipped.") from novaclient.v1_1.client import Client if not service_type: service_type = test_config.nova_client['nova_service_type'] openstack = Client(user.auth_user, user.auth_key, user.tenant, test_config.nova_client['auth_url'], service_type=service_type, no_cache=True) openstack.authenticate() return TestClient(openstack)
def get_client(cls, context): # Quite annoying but due to a paste config loading bug. # TODO(hub-cap): talk to the openstack-common people about this PROXY_ADMIN_USER = CONFIG.get('reddwarf_proxy_admin_user', 'admin') PROXY_ADMIN_PASS = CONFIG.get('reddwarf_proxy_admin_pass', '3de4922d8b6ac5a1aad9') PROXY_ADMIN_TENANT_NAME = CONFIG.get( 'reddwarf_proxy_admin_tenant_name', 'admin') PROXY_AUTH_URL = CONFIG.get('reddwarf_auth_url', 'http://0.0.0.0:5000/v2.0') client = Client(PROXY_ADMIN_USER, PROXY_ADMIN_PASS, PROXY_ADMIN_TENANT_NAME, PROXY_AUTH_URL, proxy_tenant_id=context.tenant, proxy_token=context.auth_tok, region_name='RegionOne', service_type='compute', service_name="'Compute Service'") client.authenticate() return client
def get_client(self, req): proxy_token = req.headers["X-Auth-Token"] client = Client(self.proxy_admin_user, self.proxy_admin_pass, self.proxy_admin_tenant_name, self.auth_url, token=proxy_token) client.authenticate() return client