Try getting old service type if session used
If set up old sahara service type in keystone service catalog (data_processing) then if you use keystone session for auth, saharaclient do not checks old service type. This patch fixes this problem. Change-Id: I148c0f59fde791c1c1cff63ea27fd6d489744ce1 Closes-bug: #1447797
This commit is contained in:
@@ -76,10 +76,14 @@ class Client(object):
|
||||
verify = cacert
|
||||
|
||||
session = keystone_session.Session(verify=verify)
|
||||
service_type = self._determine_service_type(session,
|
||||
auth,
|
||||
service_type,
|
||||
endpoint_type)
|
||||
|
||||
if not auth:
|
||||
auth = session.auth
|
||||
|
||||
service_type = self._determine_service_type(session,
|
||||
auth,
|
||||
service_type,
|
||||
endpoint_type)
|
||||
|
||||
kwargs['user_agent'] = USER_AGENT
|
||||
kwargs.setdefault('interface', endpoint_type)
|
||||
|
||||
@@ -353,15 +353,14 @@ class ShellTestKeystoneV3(ShellTest):
|
||||
''
|
||||
])
|
||||
|
||||
mock_session_class_name = 'keystoneclient.adapter.LegacyJsonAdapter'
|
||||
mock_get_service_type_method_name = (
|
||||
'saharaclient.api.client.Client._determine_service_type')
|
||||
mock_job_executions_class_name = (
|
||||
'saharaclient.api.job_executions.JobExecutionsManager')
|
||||
|
||||
with mock.patch(mock_session_class_name) as mock_session:
|
||||
with mock.patch(mock_get_service_type_method_name) as mock_st:
|
||||
with mock.patch(mock_job_executions_class_name):
|
||||
ms = mock_session.return_value
|
||||
ms.session.get_endpoint.return_value = 'http://no.where'
|
||||
|
||||
mock_st.return_value = 'data-processing'
|
||||
self.make_env()
|
||||
stdout, stderr = self.shell('job-list')
|
||||
self.assertEqual((stdout + stderr), expected)
|
||||
|
||||
Reference in New Issue
Block a user