Merge "Use keystone session with heatclient in integration tests"

This commit is contained in:
Zuul 2018-04-26 13:52:43 +00:00 committed by Gerrit Code Review
commit 99bc93d992
1 changed files with 12 additions and 17 deletions

View File

@ -15,7 +15,6 @@ import os
from cinderclient import client as cinder_client from cinderclient import client as cinder_client
from gnocchiclient import client as gnocchi_client from gnocchiclient import client as gnocchi_client
from heatclient import client as heat_client from heatclient import client as heat_client
from keystoneauth1 import exceptions as kc_exceptions
from keystoneauth1.identity.generic import password from keystoneauth1.identity.generic import password
from keystoneauth1 import session from keystoneauth1 import session
from neutronclient.v2_0 import client as neutron_client from neutronclient.v2_0 import client as neutron_client
@ -104,23 +103,19 @@ class ClientManager(object):
def _get_orchestration_client(self): def _get_orchestration_client(self):
endpoint = os.environ.get('HEAT_URL') endpoint = os.environ.get('HEAT_URL')
if os.environ.get('OS_NO_CLIENT_AUTH') == 'True': if os.environ.get('OS_NO_CLIENT_AUTH') == 'True':
token = None session = None
else: else:
token = self.identity_client.auth_token session = self.identity_client.session
try:
if endpoint is None: return heat_client.Client(
endpoint = self.identity_client.get_endpoint_url( self.HEATCLIENT_VERSION,
'orchestration', region=self.conf.region, endpoint,
endpoint_type=self.conf.endpoint_type) session=session,
except kc_exceptions.EndpointNotFound: endpoint_type='publicURL',
return None service_type='orchestration',
else: region_name=self.conf.region,
return heat_client.Client( username=self._username(),
self.HEATCLIENT_VERSION, password=self._password())
endpoint,
token=token,
username=self._username(),
password=self._password())
def _get_identity_client(self): def _get_identity_client(self):
user_domain_id = self.conf.user_domain_id user_domain_id = self.conf.user_domain_id