Merge "Don't use endpoint_override with session"
This commit is contained in:
commit
f2327cad82
|
@ -347,7 +347,6 @@ def _construct_http_client(endpoint=None, username=None, password=None,
|
|||
auth = kwargs.pop('auth', None)
|
||||
|
||||
if session:
|
||||
kwargs['endpoint_override'] = endpoint
|
||||
return SessionClient(session, auth=auth, **kwargs)
|
||||
else:
|
||||
return HTTPClient(endpoint=endpoint, username=username,
|
||||
|
|
|
@ -33,22 +33,23 @@ def make_client(instance):
|
|||
API_VERSIONS)
|
||||
LOG.debug('Instantiating orchestration client: %s', heat_client)
|
||||
|
||||
# Note: We can change '_interface' and '_region_name' once
|
||||
# the requirements change to python-openstackclient-2.6.1
|
||||
endpoint = instance.get_endpoint_for_service_type(
|
||||
API_NAME,
|
||||
region_name=instance._region_name,
|
||||
interface=instance._interface,
|
||||
)
|
||||
|
||||
kwargs = {'endpoint': endpoint,
|
||||
'auth_url': instance.auth.auth_url,
|
||||
'region_name': instance._region_name,
|
||||
'username': instance.auth_ref.username}
|
||||
|
||||
if instance.session:
|
||||
kwargs.update(session=instance.session)
|
||||
kwargs = {'session': instance.session,
|
||||
'service_type': API_NAME}
|
||||
else:
|
||||
# Note: We can change '_interface' and '_region_name' once
|
||||
# the requirements change to python-openstackclient-2.6.1
|
||||
endpoint = instance.get_endpoint_for_service_type(
|
||||
API_NAME,
|
||||
region_name=instance._region_name,
|
||||
interface=instance._interface,
|
||||
)
|
||||
|
||||
kwargs = {'endpoint': endpoint,
|
||||
'auth_url': instance.auth.auth_url,
|
||||
'region_name': instance._region_name,
|
||||
'username': instance.auth_ref.username}
|
||||
|
||||
kwargs.update(token=instance.auth_ref.auth_token)
|
||||
|
||||
client = heat_client(**kwargs)
|
||||
|
|
|
@ -495,7 +495,6 @@ class HeatShell(object):
|
|||
'timeout': args.api_timeout
|
||||
}
|
||||
|
||||
endpoint = args.heat_url
|
||||
service_type = args.os_service_type or 'orchestration'
|
||||
if args.os_no_client_auth:
|
||||
# Do not use session since no_client_auth means using heat to
|
||||
|
@ -507,7 +506,8 @@ class HeatShell(object):
|
|||
'token': args.os_auth_token,
|
||||
'include_pass': args.include_password,
|
||||
'insecure': args.insecure,
|
||||
'timeout': args.api_timeout
|
||||
'timeout': args.api_timeout,
|
||||
'endpoint': args.heat_url
|
||||
}
|
||||
else:
|
||||
keystone_session = self._get_keystone_session(**kwargs)
|
||||
|
@ -534,13 +534,7 @@ class HeatShell(object):
|
|||
'project_domain_name': args.os_project_domain_name,
|
||||
}
|
||||
keystone_auth = generic.Password(**kwargs)
|
||||
if not endpoint:
|
||||
svc_type = service_type
|
||||
region_name = args.os_region_name
|
||||
endpoint = keystone_auth.get_endpoint(keystone_session,
|
||||
service_type=svc_type,
|
||||
interface=endpoint_type,
|
||||
region_name=region_name)
|
||||
|
||||
kwargs = {
|
||||
'auth_url': args.os_auth_url,
|
||||
'session': keystone_session,
|
||||
|
@ -553,7 +547,7 @@ class HeatShell(object):
|
|||
'include_pass': args.include_password
|
||||
}
|
||||
|
||||
client = heat_client.Client(api_version, endpoint, **kwargs)
|
||||
client = heat_client.Client(api_version, **kwargs)
|
||||
|
||||
profile = osprofiler_profiler and options.profile
|
||||
if profile:
|
||||
|
|
|
@ -620,7 +620,7 @@ class ShellTestEndpointType(TestCase):
|
|||
'password': 'password',
|
||||
'include_pass': False
|
||||
}
|
||||
http._construct_http_client(u'http://heat.example.com', **kwargs)
|
||||
http._construct_http_client(**kwargs)
|
||||
heatclient.v1.shell.do_stack_list(mox.IgnoreArg(), mox.IgnoreArg())
|
||||
|
||||
self.m.ReplayAll()
|
||||
|
@ -639,7 +639,7 @@ class ShellTestEndpointType(TestCase):
|
|||
'password': 'password',
|
||||
'include_pass': False
|
||||
}
|
||||
http._construct_http_client(u'http://heat-admin.localdomain', **kwargs)
|
||||
http._construct_http_client(**kwargs)
|
||||
heatclient.v1.shell.do_stack_list(mox.IgnoreArg(), mox.IgnoreArg())
|
||||
|
||||
self.m.ReplayAll()
|
||||
|
@ -660,7 +660,7 @@ class ShellTestEndpointType(TestCase):
|
|||
'password': 'password',
|
||||
'include_pass': False
|
||||
}
|
||||
http._construct_http_client(u'http://heat.localdomain', **kwargs)
|
||||
http._construct_http_client(**kwargs)
|
||||
heatclient.v1.shell.do_stack_list(mox.IgnoreArg(), mox.IgnoreArg())
|
||||
|
||||
self.m.ReplayAll()
|
||||
|
|
Loading…
Reference in New Issue