Use keystone session with heatclient in integration tests

Change-Id: I4c66927e3dd3e1a91cfab94f26a24dbe8932bde8
Related-Bug: #1695144
This commit is contained in:
rabi 2017-02-18 13:02:20 +05:30 committed by Rabi Mishra
parent faacff2d7e
commit 97f2636dc7
1 changed files with 12 additions and 16 deletions

View File

@ -15,7 +15,6 @@ import os
from cinderclient import client as cinder_client from cinderclient import client as cinder_client
from heat.common.i18n import _ from heat.common.i18n import _
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,22 +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', self.conf.region) endpoint,
except kc_exceptions.EndpointNotFound: session=session,
return None endpoint_type='publicURL',
else: service_type='orchestration',
return heat_client.Client( region_name=self.conf.region,
self.HEATCLIENT_VERSION, username=self._username(),
endpoint, password=self._password())
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