From 324724b9502fd79eed3a6954fe2ecd2494297398 Mon Sep 17 00:00:00 2001 From: liyingjun Date: Sat, 12 Dec 2015 03:07:56 +0800 Subject: [PATCH] Support token based auth options for osc Currently, the searchlightclient osc plugin assumes the presence of auth_url, username, password options when creating the SL client object. It should support passing --os-token (OS_TOKEN) and --os-url (OS_URL) to openstackclient, which skips token generation and catalog retrieval. Change-Id: Ied8f32c18e6e25130e14e37a170c786bc5a90f29 Closes-bug: #1539260 --- searchlightclient/osc/plugin.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/searchlightclient/osc/plugin.py b/searchlightclient/osc/plugin.py index d6061c6..d3e5279 100644 --- a/searchlightclient/osc/plugin.py +++ b/searchlightclient/osc/plugin.py @@ -32,13 +32,16 @@ def make_client(instance): instance._api_version[API_NAME], API_VERSIONS) + # Set client http_log_debug to True if verbosity level is high enough + http_log_debug = utils.get_effective_log_level() <= logging.DEBUG + + # Remember interface only if it is set + kwargs = utils.build_kwargs_dict('endpoint_type', instance._interface) client = search_client( - endpoint=instance.get_endpoint_for_service_type('search'), session=instance.session, - auth_url=instance._auth_url, - username=instance._username, - password=instance._password, + http_log_debug=http_log_debug, region_name=instance._region_name, + **kwargs ) return client