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
This commit is contained in:
Li Wei 2016-08-13 00:54:03 +08:00 committed by ChangBo Guo(gcb)
parent 3ddd62f4bb
commit e5ae694c62

View File

@ -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