From e5ae694c62100a6bf4a9da3b001334584a759be6 Mon Sep 17 00:00:00 2001 From: Li Wei Date: Sat, 13 Aug 2016 00:54:03 +0800 Subject: [PATCH] Change keystoneclient to keystoneauth1 We don not need to call Unauthorized in keystoneclient.exceptions, then call Unauthorized in keystoneauth1.exceptions.http next.We can just call it in keystoneauth1.exceptions.http directly.This can improve code readability and searching efficiency. Change-Id: Ia4067525d208a92aa1625972ff893dfa581e9f99 --- glance/common/trust_auth.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/glance/common/trust_auth.py b/glance/common/trust_auth.py index 67963a2589..ff3cf3a100 100644 --- a/glance/common/trust_auth.py +++ b/glance/common/trust_auth.py @@ -12,10 +12,10 @@ # License for the specific language governing permissions and limitations # under the License. +from keystoneauth1 import exceptions as ka_exceptions from keystoneauth1.identity import v3 from keystoneauth1.loading import conf from keystoneauth1.loading import session -from keystoneclient import exceptions as ks_exceptions from keystoneclient.v3 import client as ks_client from oslo_config import cfg from oslo_log import log as logging @@ -79,7 +79,7 @@ class TokenRefresher(object): self.trustee_client = self._refresh_trustee_client() try: return self.trustee_client.session.get_token() - except ks_exceptions.Unauthorized: + except ka_exceptions.Unauthorized: # in case of Unauthorized exceptions try to refresh client because # service user token may expired self.trustee_client = self._refresh_trustee_client() @@ -93,7 +93,7 @@ class TokenRefresher(object): self._refresh_trustee_client().trusts.delete(self.trust_id) else: self.trustee_client.trusts.delete(self.trust_id) - except ks_exceptions.Unauthorized: + except ka_exceptions.Unauthorized: # service user token may expire when we are trying to delete token # so need to update client to ensure that this is not the reason # of failure