Fix issue with V3 Authentication.

Unscoped token does not have a roles attribute in it. Fix the
code to handle non-existent of roles in the Auth Token.

Fixes: bug #1202385

Change-Id: I2bd101e3ed2dd37da86f84773c2b9dafc0717d3b
This commit is contained in:
Lin Hua Cheng 2013-07-17 13:47:11 -07:00
parent 546716c585
commit 047f7b5ff1
2 changed files with 2 additions and 3 deletions

View File

@ -213,7 +213,6 @@ def generate_test_data():
'name': domain_dict['name']
}
},
'roles': [role_dict],
'catalog': [keystone_service]
}
}

View File

@ -77,9 +77,9 @@ class Token(object):
self.domain = domain
if auth_ref.version == 'v2.0':
self.roles = auth_ref['user']['roles']
self.roles = auth_ref['user'].get('roles', [])
else:
self.roles = auth_ref['roles']
self.roles = auth_ref.get('roles', [])
if get_keystone_version() < 3:
self.serviceCatalog = auth_ref.get('serviceCatalog', [])