From 3906c41d43cc4b3bf6275f123ee77cd8f04b5989 Mon Sep 17 00:00:00 2001 From: Goutham Pratapa Date: Mon, 21 Aug 2017 15:30:32 +0530 Subject: [PATCH] Usage of Plugins instead of keystone client. In Kingbird there are few api calls which are deprecated in Pike release.This Fix is to address this issue. Closes-bug: #1712036 Change-Id: I605e3fabe8063999457bb67545029e83a33fee0c --- kingbird/common/endpoint_cache.py | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/kingbird/common/endpoint_cache.py b/kingbird/common/endpoint_cache.py index 7628e6e..77f2b1c 100644 --- a/kingbird/common/endpoint_cache.py +++ b/kingbird/common/endpoint_cache.py @@ -15,11 +15,11 @@ import collections -from keystoneauth1.identity import v3 as auth_identity from keystoneauth1 import loading from keystoneauth1 import session -from keystoneclient.auth import token_endpoint + from keystoneclient.v3 import client as keystone_client + from oslo_config import cfg @@ -31,24 +31,16 @@ class EndpointCache(object): self._update_endpoints() @staticmethod - def _get_admin_token(self): - auth = auth_identity.Password( + def _get_endpoint_from_keystone(self): + loader = loading.get_plugin_loader( + cfg.CONF.keystone_authtoken.auth_type) + auth = loader.load_from_options( auth_url=cfg.CONF.cache.auth_uri, username=cfg.CONF.cache.admin_username, password=cfg.CONF.cache.admin_password, - project_name=cfg.CONF.cache.admin_tenant, - user_domain_name=cfg.CONF.cache.admin_user_domain_name, - project_domain_name=cfg.CONF.cache.admin_project_domain_name) - sess = session.Session(auth=auth) - self.admin_session = sess - return sess.get_token() - - @staticmethod - def _get_endpoint_from_keystone(self): - auth = token_endpoint.Token(cfg.CONF.cache.auth_uri, - EndpointCache._get_admin_token(self)) - sess = session.Session(auth=auth) - cli = keystone_client.Client(session=sess) + project_id=cfg.CONF.cache.admin_tenant) + self.admin_session = session.Session(auth=auth) + cli = keystone_client.Client(session=self.admin_session) self.keystone_client = cli service_id_name_map = {}