diff options
author | Sergey Vilgelm <svilgelm@mirantis.com> | 2013-06-24 13:41:07 +0400 |
---|---|---|
committer | Sergey Vilgelm <svilgelm@mirantis.com> | 2013-06-24 13:41:07 +0400 |
commit | f79ccf452b7a0cbf51c63adf259f46896586dc16 (patch) | |
tree | db8ae449b7b6e957961f967357543f3874c84ee1 /keystone/auth | |
parent | f1cfbd78ac1d50a42975ea219919a398f634f7f5 (diff) | |
download | keystone-f79ccf452b7a0cbf51c63adf259f46896586dc16.tar.gz keystone-f79ccf452b7a0cbf51c63adf259f46896586dc16.tar.xz keystone-f79ccf452b7a0cbf51c63adf259f46896586dc16.zip |
Do not raise NEW exceptions
Raising NEW exception is bad practice, because we lose TraceBack.
So all places like:
except SomeException as e:
raise e
should be replaced by
except SomeException:
raise
If we are doing some other actions before reraising we should
store information about exception then do all actions and then
reraise it. This is caused by eventlet bug. It lost information
about exception if it switch threads.
fixes bug 1191730
Change-Id: I8dffc36ba5780911dd57d7161d218d0324af60b3
Diffstat (limited to 'keystone/auth')
-rw-r--r-- | keystone/auth/token_factory.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/keystone/auth/token_factory.py b/keystone/auth/token_factory.py index 64f945fa..fd44b637 100644 --- a/keystone/auth/token_factory.py +++ b/keystone/auth/token_factory.py @@ -17,6 +17,7 @@ """Token Factory""" import json +import sys import uuid import webob @@ -338,14 +339,14 @@ def create_token(context, auth_context, auth_info): token_data=token_data, trust_id=trust['id'] if trust else None) token_api.create_token(context, token_id, data) - except Exception as e: + except Exception: + exc_info = sys.exc_info() # an identical token may have been created already. # if so, return the token_data as it is also identical try: - token_api.get_token(context=context, - token_id=token_id) + token_api.get_token(context=context, token_id=token_id) except exception.TokenNotFound: - raise e + raise exc_info[0], exc_info[1], exc_info[2] return (token_id, token_data) |