Keystone Admin - Deleting a roleRef for a non existent user or role returns Internal Server Error

Bug #999567 reported by Rohit Karajgi
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Medium
Vincent Untz

Bug Description

Our tempest test calls the delete_role_ref() Admin API and passes an invalid/non-existent value for userId / roleID.

Expected result: HTTP 404 NotFound or HTTP 400 BadRequest error.
Actual Result: HTTP 500 Internal Server Error is returned

======================================================================
ERROR: Attempt to delete a role from a non existent user should fail
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/stack/tempest/tests/identity/test_roles.py", line 185, in test_delete_user_role_non_existant_user
    'junk-user-id-123', role['id'])
  File "/usr/lib/pymodules/python2.7/unittest2/case.py", line 475, in assertRaises
    callableObj(*args, **kwargs)
  File "/opt/stack/tempest/services/identity/json/admin_client.py", line 80, in delete_user_role
    resp, body = self.delete('users/%s/roleRefs/%s' % (user_id, role_id))
  File "/opt/stack/tempest/common/rest_client.py", line 163, in delete
    return self.request('DELETE', url)
  File "/opt/stack/tempest/common/rest_client.py", line 229, in request
    message = resp_body['computeFault']['message']
KeyError: '\'computeFault\'\n-------------------- >> begin captured logging << --------------------\ntempest.config: INFO: Using tempest config file /opt/stack/etc/tempest.conf\ntempest.common.rest_client: ERROR: Request URL: http://10.2.3.164:35357/v2.0/users/junk-user-id-123/roleRefs/3d3fb10c2b184204a484bfe0440ac38c\ntempest.common.rest_client: ERROR: Request Body: None\ntempest.common.rest_client: ERROR: Response Headers: {\'date\': \'Tue, 15 May 2012 09:49:37 GMT\', \'content-type\': \'application/json\', \'content-length\': \'182\', \'status\': \'500\', \'vary\': \'X-Auth-Token\'}\ntempest.common.rest_client: ERROR: Response Body: {u\'error\': {u\'message\': u"An unexpected error prevented the server from fulfilling your request. \'NoneType\' object is not subscriptable", u\'code\': 500, u\'title\': u\'Internal Server Error\'}}\n--------------------- >> end captured logging << ---------------------'

----------------------------------------------------------------------

======================================================================
ERROR: Attempt to delete a non existent role for a user should fail
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/stack/tempest/tests/identity/test_roles.py", line 194, in test_delete_user_role_non_existant_role
    user['id'], 'junk-user-role-123')
  File "/usr/lib/pymodules/python2.7/unittest2/case.py", line 475, in assertRaises
    callableObj(*args, **kwargs)
  File "/opt/stack/tempest/services/identity/json/admin_client.py", line 80, in delete_user_role
    resp, body = self.delete('users/%s/roleRefs/%s' % (user_id, role_id))
  File "/opt/stack/tempest/common/rest_client.py", line 163, in delete
    return self.request('DELETE', url)
  File "/opt/stack/tempest/common/rest_client.py", line 229, in request
    message = resp_body['computeFault']['message']
KeyError: '\'computeFault\'\n-------------------- >> begin captured logging << --------------------\ntempest.config: INFO: Using tempest config file /opt/stack/etc/tempest.conf\ntempest.common.rest_client: ERROR: Request URL: http://10.2.3.164:35357/v2.0/users/6c4298c4bd0349e59dc6a2a151fee416/roleRefs/junk-user-role-123\ntempest.common.rest_client: ERROR: Request Body: None\ntempest.common.rest_client: ERROR: Response Headers: {\'date\': \'Tue, 15 May 2012 09:58:18 GMT\', \'content-type\': \'application/json\', \'content-length\': \'182\', \'status\': \'500\', \'vary\': \'X-Auth-Token\'}\ntempest.common.rest_client: ERROR: Response Body: {u\'error\': {u\'message\': u"An unexpected error prevented the server from fulfilling your request. \'NoneType\' object is not subscriptable", u\'code\': 500, u\'title\': u\'Internal Server Error\'}}\n--------------------- >> end captured logging << ---------------------'

----------------------------------------------------------------------

Rohit Karajgi (rohitk)
summary: - Keystone Admin - Deleting a roleRef for a non existent user returns
- Internal Server Error
+ Keystone Admin - Deleting a roleRef for a non existent user or role
+ returns Internal Server Error
description: updated
Rohit Karajgi (rohitk)
affects: nova → keystone
Joseph Heck (heckj)
Changed in keystone:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

Fix proposed to branch: master
Review: https://review.openstack.org/9000

Changed in keystone:
assignee: nobody → Vincent Untz (vuntz)
status: Triaged → In Progress
Revision history for this message
Vincent Untz (vuntz) wrote :

For the record, since user roles (without any tenant) are not supported, 501 will be returned now. So not what you would expect at first, but at least, it's not 500.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/9000
Committed: http://github.com/openstack/keystone/commit/d3058a1c41bfd45be4a298679392a448662ecc00
Submitter: Jenkins
Branch: master

commit d3058a1c41bfd45be4a298679392a448662ecc00
Author: Vincent Untz <email address hidden>
Date: Tue Jun 26 15:57:44 2012 +0200

    Do not crash when trying to remove a user role (without a tenant)

    Fix bug 999567.

    Just use the right method, to stop returning an internal server error
    (500). We will return 501 instead, since we stopped supporting user
    roles, but at least this is not crashing.

    Change-Id: Ia2d6815e712daf146abba5089b79afc8aaddb2d2

Changed in keystone:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in keystone:
milestone: none → folsom-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in keystone:
milestone: folsom-2 → 2012.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.