diff options
Diffstat (limited to 'keystoneclient/session.py')
-rw-r--r-- | keystoneclient/session.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/keystoneclient/session.py b/keystoneclient/session.py index 69d0701..668a37a 100644 --- a/keystoneclient/session.py +++ b/keystoneclient/session.py @@ -57,16 +57,21 @@ def request(url, method='GET', **kwargs): def remove_service_catalog(body): try: data = jsonutils.loads(body) - except ValueError: - return body - try: - if 'catalog' in data['token']: + + # V3 token + if 'token' in data and 'catalog' in data['token']: data['token']['catalog'] = '<removed>' return jsonutils.dumps(data) - else: - return body - except KeyError: - return body + + # V2 token + if 'serviceCatalog' in data['access']: + data['access']['serviceCatalog'] = '<removed>' + return jsonutils.dumps(data) + + except Exception: + # Don't fail trying to clean up the request body. + pass + return body class Session(object): |