List Trusts generates HTTP Error 500
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Identity (keystone) |
Fix Released
|
Medium
|
Steven Hardy | ||
Havana |
Fix Released
|
Medium
|
Jamie Lennox |
Bug Description
We are getting an HTTP 500 error when we try to list all trusts. We can list individual trusts, but not the generic list.
GET REST Request:
curl -v -X GET http://
------
REST Response:
{
"error": {
"message": "An unexpected error prevented the server from fulfilling your request. 'id'",
"code": 500,
"title": "Internal Server Error"
}
}
-------
/var/log/
Traceback (most recent call last):
File "/usr/local/
result = method(context, **params)
File "/usr/local/
return f(self, context, *args, **kwargs)
File "/usr/local/
self.
File "/usr/local/
if x['id'] == trust_role['id']]
KeyError: 'id'
2013-10-28 09:49:04 INFO [access] 15.253.57.88 - - [28/Oct/
-------
/var/log/
2013-10-28 09:49:04 ERROR [keystone.
2013-10-28 09:49:04 ERROR [keystone.
2013-10-28 09:49:04 ERROR [keystone.
Traceback (most recent call last):
File "/usr/local/
result = method(context, **params)
File "/usr/local/
return f(self, context, *args, **kwargs)
File "/usr/local/
self.
File "/usr/local/
if x['id'] == trust_role['id']]
KeyError: 'id'
2013-10-28 09:49:04 INFO [access] 15.253.57.88 - - [28/Oct/
--------------
Method causing the error with inserted LOG statements:
def _fill_in_
if trust.get(
if 'roles' not in trust:
for trust_role in trust['roles']:
if isinstance(
if matching_roles:
'self': (self.base_url() + "/%s/roles" % trust['id']),
'next': None,
-------
Quick change I made to get around the problem:
def _fill_in_
if trust.get(
if 'roles' not in trust:
for trust_role in trust['roles']:
if isinstance(
# Inserted if statement below to fix HTTP 500 error
if not 'id' in trust_role:
if matching_roles:
'self': (self.base_url() + "/%s/roles" % trust['id']),
'next': None,
-------
Summary:
In the code above, the trust_role is not a basestring so the "trust_role = {'id':trust_role}" assignment is not occurring, but the
trust_role Dictionary (trust_role = {u'name': u'disney_user'}) does not have an 'id' key in it so the line " if x['id'] == trust_role['id']]"
throws an exception. I added the following conditional check and it seems to work now:
if not 'id' in trust_role:
Changed in keystone: | |
assignee: | nobody → Adam Young (ayoung) |
Changed in keystone: | |
importance: | Undecided → Medium |
tags: | added: havana-backport-potential |
Changed in keystone: | |
status: | New → Confirmed |
Changed in keystone: | |
assignee: | Steven Hardy (shardy) → Dolph Mathews (dolph) |
Changed in keystone: | |
assignee: | Dolph Mathews (dolph) → Steven Hardy (shardy) |
Changed in keystone: | |
milestone: | none → icehouse-2 |
status: | Fix Committed → Fix Released |
tags: | removed: havana-backport-potential |
Changed in keystone: | |
milestone: | icehouse-2 → 2014.1 |
Confirmed, I'm seeing the same issue @ f4a441c38a1486c 789a70f3de7b419 f11c386048