Specifying incorrect tenant yields 500

Bug #954547 reported by Anthony Young
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Low
Dolph Mathews

Bug Description

Steps to reproduce:

Using devstack:

> . openrc admin badtenant
> keystone --debug --auth_url=http://127.0.0.1:35357/v2.0 role-list

Expected:

Some sort of auth error

Actual:

$ keystone --debug --auth_url=http://127.0.0.1:35357/v2.0 role-list
connect: (127.0.0.1, 35357)
send: 'POST /v2.0/tokens HTTP/1.1\r\nHost: 127.0.0.1:35357\r\nContent-Length: 104\r\ncontent-type: application/json\r\naccept-encoding: gzip, deflate\r\nuser-agent: python-keystoneclient\r\n\r\n{"auth": {"tenantName": "secrete", "passwordCredentials": {"username": "admin", "password": "secrete"}}}'
reply: 'HTTP/1.1 200 OK\r\n'
header: Content-Type: application/json
header: Vary: X-Auth-Token
header: Content-Length: 244
header: Date: Tue, 13 Mar 2012 22:51:32 GMT
No handlers could be found for logger "keystoneclient.v2_0.client"
send: 'GET /v2.0/OS-KSADM/roles HTTP/1.1\r\nHost: 127.0.0.1:35357\r\nx-auth-token: d63a897216b6445bab1c62448e5a7840\r\naccept-encoding: gzip, deflate\r\nuser-agent: python-keystoneclient\r\n\r\n'
reply: 'HTTP/1.1 500 Internal Server Error\r\n'
header: Content-Type: text/plain
header: Content-Length: 4999
header: Date: Tue, 13 Mar 2012 22:51:32 GMT
header: Connection: close
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 "/opt/stack/python-keystoneclient/keystoneclient/shell.py", line 255, in main
    OpenStackIdentityShell().main(sys.argv[1:])
  File "/opt/stack/python-keystoneclient/keystoneclient/shell.py", line 215, in main
    args.func(self.cs, args)
  File "/opt/stack/python-keystoneclient/keystoneclient/v2_0/shell.py", line 196, in do_role_list
    roles = kc.roles.list()
  File "/opt/stack/python-keystoneclient/keystoneclient/v2_0/roles.py", line 51, in list
    return self._list("/OS-KSADM/roles", "roles")
  File "/opt/stack/python-keystoneclient/keystoneclient/base.py", line 65, in _list
    resp, body = self.api.get(url)
  File "/opt/stack/python-keystoneclient/keystoneclient/client.py", line 166, in get
    return self._cs_request(url, 'GET', **kwargs)
  File "/opt/stack/python-keystoneclient/keystoneclient/client.py", line 150, in _cs_request
    **kwargs)
  File "/opt/stack/python-keystoneclient/keystoneclient/client.py", line 130, in request
    raise exceptions.from_response(resp, body)
keystoneclient.exceptions.ClientException: Unable to communicate with identity service: Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/eventlet/wsgi.py", line 336, in handle_one_response
    result = self.application(self.environ, start_response)
  File "/usr/lib/python2.7/dist-packages/paste/urlmap.py", line 203, in __call__
    return app(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in call_func
    return self.func(req, *args, **kwargs)
  File "/opt/stack/keystone/keystone/common/wsgi.py", line 284, in __call__
    response = request.get_response(self.application)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1053, in get_response
    application, catch_exc_info=False)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1022, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in call_func
    return self.func(req, *args, **kwargs)
  File "/opt/stack/keystone/keystone/common/wsgi.py", line 284, in __call__
    response = request.get_response(self.application)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1053, in get_response
    application, catch_exc_info=False)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1022, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in call_func
    return self.func(req, *args, **kwargs)
  File "/opt/stack/keystone/keystone/common/wsgi.py", line 284, in __call__
    response = request.get_response(self.application)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1053, in get_response
    application, catch_exc_info=False)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1022, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in call_func
    return self.func(req, *args, **kwargs)
  File "/opt/stack/keystone/keystone/common/wsgi.py", line 284, in __call__
    response = request.get_response(self.application)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1053, in get_response
    application, catch_exc_info=False)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1022, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in call_func
    return self.func(req, *args, **kwargs)
  File "/opt/stack/keystone/keystone/common/wsgi.py", line 307, in __call__
    resp = req.get_response(self.application)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1053, in get_response
    application, catch_exc_info=False)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1022, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 159, in __call__
    return resp(environ, start_response)
  File "/usr/lib/pymodules/python2.7/routes/middleware.py", line 131, in __call__
    response = self.app(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 159, in __call__
    return resp(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 159, in __call__
    return resp(environ, start_response)
  File "/usr/lib/pymodules/python2.7/routes/middleware.py", line 131, in __call__
    response = self.app(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 159, in __call__
    return resp(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in call_func
    return self.func(req, *args, **kwargs)
  File "/opt/stack/keystone/keystone/common/wsgi.py", line 181, in __call__
    result = method(context, **params)
  File "/opt/stack/keystone/keystone/identity/core.py", line 454, in get_roles
    self.assert_admin(context)
  File "/opt/stack/keystone/keystone/common/wsgi.py", line 212, in assert_admin
    creds['tenant_id'] = user_token_ref['tenant'].get('id')
AttributeError: 'NoneType' object has no attribute 'get'
. (HTTP 500)

Dolph Mathews (dolph)
Changed in keystone:
assignee: nobody → Dolph Mathews (dolph)
importance: Undecided → Low
status: New → Confirmed
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/5313

Changed in keystone:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

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

commit d2c6e88200bb33708a0861da4d1a10c0f7984895
Author: Dolph Mathews <email address hidden>
Date: Tue Mar 13 22:06:34 2012 -0500

    Raising unauthorized instead of 500 (bug 954547)

    Change-Id: I557ff1ca51261edf0824aeb4565816216c59c76e

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