Add invalid role id to user on tenant is not raising proper exception

Bug #1006316 reported by Rajalakshmi Ganesan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Critical
Dolph Mathews

Bug Description

Add invalid role id to user on tenant is not raising proper exception. When invlid role ID is sent in the request while adding role to user on tenant, 200 response code is obtained.

Expected Result:
Expect Role not found with given ID kind of message to be thrown. i.e error response code of 404 should be throw indicating Not Found.

Actual result:

The response header and body are as follows :
{'date': 'Wed, 30 May 2012 15:20:07 GMT', 'content-type': 'application/json', 'content-length': '14', 'status': '200', 'vary': 'X-Auth-Token'}
{"role": null}

LOG-
------
rajalakshmi_ganesan@pshys0183~json:-( >keystone --debug user-role-add --tenant_id 22de173542754eef8996521b731ae7ef --user 3dcb7b5ccf6246a28887cc124683a6db --role ALPHA
connect: (10.233.52.27, 5000)
send: 'POST /v2.0/tokens HTTP/1.1\r\nHost: 10.233.52.27:5000\r\nAccept-Encoding: identity\r\nContent-Length: 127\r\ncontent-type: application/json\r\nuser-agent: python-keystoneclient\r\n\r\n{"auth": {"passwordCredentials": {"username": "admin", "password": "muralik"}, "tenantId": "22de173542754eef8996521b731ae7ef"}}'
reply: 'HTTP/1.1 200 OK\r\n'
header: Content-Type: application/json
header: Vary: X-Auth-Token
header: Content-Length: 2229
header: Date: Wed, 30 May 2012 15:35:43 GMT
connect: (10.233.52.27, 35357)
send: u'PUT /v2.0/tenants/22de173542754eef8996521b731ae7ef/users/3dcb7b5ccf6246a28887cc124683a6db/roles/OS-KSADM/ALPHA HTTP/1.1\r\nHost: 10.233.52.27:35357\r\nAccept-Encoding: identity\r\nContent-Length: 4\r\nx-auth-token: 81bcf1f40733469f85afdae675c5a4ac\r\ncontent-type: application/json\r\nuser-agent: python-keystoneclient\r\n\r\nnull'
reply: 'HTTP/1.1 200 OK\r\n'
header: Content-Type: application/json
header: Vary: X-Auth-Token
header: Content-Length: 14
header: Date: Wed, 30 May 2012 15:35:44 GMT
Traceback (most recent call last):
  File "/usr/local/bin/keystone", line 9, in <module>
    load_entry_point('python-keystoneclient==2012.1', 'console_scripts', 'keystone')()
  File "/usr/local/lib/python2.7/dist-packages/python_keystoneclient-2012.1-py2.7.egg/keystoneclient/shell.py", line 310, in main
    OpenStackIdentityShell().main(sys.argv[1:])
  File "/usr/local/lib/python2.7/dist-packages/python_keystoneclient-2012.1-py2.7.egg/keystoneclient/shell.py", line 270, in main
    args.func(self.cs, args)
  File "/usr/local/lib/python2.7/dist-packages/python_keystoneclient-2012.1-py2.7.egg/keystoneclient/v2_0/shell.py", line 235, in do_user_role_add
    kc.roles.add_user_role(args.user, args.role, args.tenant_id)
  File "/usr/local/lib/python2.7/dist-packages/python_keystoneclient-2012.1-py2.7.egg/keystoneclient/v2_0/roles.py", line 73, in add_user_role
    return self._update(route % params, None, "role")
  File "/usr/local/lib/python2.7/dist-packages/python_keystoneclient-2012.1-py2.7.egg/keystoneclient/base.py", line 100, in _update
    return self.resource_class(self, body[response_key])
  File "/usr/local/lib/python2.7/dist-packages/python_keystoneclient-2012.1-py2.7.egg/keystoneclient/base.py", line 154, in __init__
    self._add_details(info)
  File "/usr/local/lib/python2.7/dist-packages/python_keystoneclient-2012.1-py2.7.egg/keystoneclient/base.py", line 158, in _add_details
    for (k, v) in info.iteritems():
AttributeError: 'NoneType' object has no attribute 'iteritems'

Revision history for this message
Rajalakshmi Ganesan (rajalakshmi-ganesan) wrote :

The invalid inputs given as role ids were:
1. 99968988798
2.alpha
3.dddd@#%%^$
4.!@#()$%^&*?<>{}[]

affects: tempest → keystone
Joseph Heck (heckj)
Changed in keystone:
status: New → Confirmed
importance: Undecided → High
importance: High → Critical
Revision history for this message
Dolph Mathews (dolph) wrote :

This should be fixed by a patch already in review: https://review.openstack.org/#/c/6875/

Changed in keystone:
assignee: nobody → Dolph Mathews (dolph)
status: Confirmed → In Progress
Revision history for this message
Dolph Mathews (dolph) wrote :

Fixed in 23ca656927947dada40591bdd1badd5a531c2983

Changed in keystone:
milestone: none → folsom-2
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in keystone:
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.