Failed when adding user to project

Bug #1079013 reported by irsxyp
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
New
Undecided
irsxyp

Bug Description

When I try to add a user into project via dashboard, I got the following error message in dashboard:

'Error: Unable to add user to project.'

Also there is error message in keystone.log. After digging into keystone code, I found that this is related to sql backend identification. I have submit a patch(https://review.openstack.org/#/c/15697/) to fix this problem.

Related keystone log:
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] ******************** REQUEST ENVIRON ********************
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] SCRIPT_NAME = /v2.0
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] webob.adhoc_attrs = {'response': <Response at 0x2282390 200 OK>}
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] REQUEST_METHOD = GET
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] PATH_INFO = /OS-KSADM/roles
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] SERVER_PROTOCOL = HTTP/1.0
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] HTTP_X_AUTH_TOKEN = fa859d9eb7804d9aaa7c56f1d8c41537
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] HTTP_USER_AGENT = python-keystoneclient
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] eventlet.posthooks = []
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] SERVER_NAME = 172.23.0.109
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] REMOTE_ADDR = 172.23.0.109
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] eventlet.input = <eventlet.wsgi.Input object at 0x2111410>
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] wsgi.url_scheme = http
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] SERVER_PORT = 35357
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] wsgi.input = <eventlet.wsgi.Input object at 0x2111410>
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] openstack.context = {'token_id': 'fa859d9eb7804d9aaa7c56f1d8c41537', 'is_admin': False}
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] HTTP_HOST = 172.23.0.109:35357
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] wsgi.multithread = True
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] wsgi.version = (1, 0)
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] RAW_PATH_INFO = /v2.0/OS-KSADM/roles
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] GATEWAY_INTERFACE = CGI/1.1
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] wsgi.run_once = False
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] wsgi.errors = <open file '<stderr>', mode 'w' at 0x7f82a3cd31e0>
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] wsgi.multiprocess = False
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] CONTENT_TYPE = text/plain
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] HTTP_ACCEPT_ENCODING = gzip, deflate
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi]
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] ******************** REQUEST BODY ********************
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi]
2012-11-15 11:52:57 DEBUG [routes.middleware] Matched GET /OS-KSADM/roles
2012-11-15 11:52:57 DEBUG [routes.middleware] Route path: '{path_info:.*}', defaults: {'controller': <keystone.contrib.admin_crud.core.CrudExtension object at 0x1d74cd0>}
2012-11-15 11:52:57 DEBUG [routes.middleware] Match dict: {'controller': <keystone.contrib.admin_crud.core.CrudExtension object at 0x1d74cd0>, 'path_info': '/OS-KSADM/roles'}
2012-11-15 11:52:57 DEBUG [routes.middleware] Matched GET /OS-KSADM/roles
2012-11-15 11:52:57 DEBUG [routes.middleware] Route path: '/OS-KSADM/roles', defaults: {'action': u'get_roles', 'controller': <keystone.identity.core.RoleController object at 0x1d748d0>}
2012-11-15 11:52:57 DEBUG [routes.middleware] Match dict: {'action': u'get_roles', 'controller': <keystone.identity.core.RoleController object at 0x1d748d0>}
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] arg_dict: {}
2012-11-15 11:52:57 DEBUG [keystone.policy.backends.rules] enforce admin_required: {'tenant_id': u'6f53d7b0a37f4245acf577eb4d88869d', 'user_id': u'5e41f77143c5406e9ce6612d80203dcf', u'roles': [u'admin', u'KeystoneServiceAdmin', u'KeystoneAdmin']}
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] ******************** RESPONSE HEADERS ********************
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] Vary = X-Auth-Token
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] Content-Type = application/json
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] Content-Length = 407
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi]
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] ******************** RESPONSE BODY ********************
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] {"roles": [{"id": "8461e7e1feb246b8b8c2c650399e0053", "name": "admin"}, {"id": "8de7dabb47f44d47b36f0549b4db4854", "name": "Member"}, {"id": "b35f2ea684d9464ca3e68fc953abaa87", "name": "KeystoneAdmin"}, {"id": "0b5270c96c72461989a34fc2415abc93", "name": "KeystoneServiceAdmin"}, {"id": "4a50edfa4f8649739d4b21776c26e2fb", "name": "sysadmin"}, {"id": "655f80ec0cc3441fbdb15bae5bd6f28d", "name": "netadmin"}]}
2012-11-15 11:52:57 DEBUG [eventlet.wsgi.server] 172.23.0.109 - - [15/Nov/2012 11:52:57] "GET /v2.0/OS-KSADM/roles HTTP/1.1" 200 536 0.027059

2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] ******************** REQUEST ENVIRON ********************
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] SCRIPT_NAME = /v2.0
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] webob.adhoc_attrs = {'response': <Response at 0x2324650 200 OK>}
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] REQUEST_METHOD = PUT
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] PATH_INFO = /tenants/7d24dc1bb64044c3b887b431b6f8fbe7/users/be199b0acc1e4d73adfd4eed5ab15fb8/roles/OS-KSADM/8de7dabb47f44d47b36f0549b4db4854
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] SERVER_PROTOCOL = HTTP/1.0
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] CONTENT_LENGTH = 4
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] HTTP_X_AUTH_TOKEN = fa859d9eb7804d9aaa7c56f1d8c41537
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] HTTP_USER_AGENT = python-keystoneclient
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] eventlet.posthooks = []
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] RAW_PATH_INFO = /v2.0/tenants/7d24dc1bb64044c3b887b431b6f8fbe7/users/be199b0acc1e4d73adfd4eed5ab15fb8/roles/OS-KSADM/8de7dabb47f44d47b36f0549b4db4854
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] REMOTE_ADDR = 172.23.0.109
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] eventlet.input = <eventlet.wsgi.Input object at 0x1f68a90>
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] wsgi.url_scheme = http
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] SERVER_PORT = 35357
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] wsgi.input = <cStringIO.StringI object at 0x228fc90>
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] openstack.context = {'token_id': 'fa859d9eb7804d9aaa7c56f1d8c41537', 'is_admin': False}
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] HTTP_HOST = 172.23.0.109:35357
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] wsgi.multithread = True
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] openstack.params = {}
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] wsgi.version = (1, 0)
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] SERVER_NAME = 172.23.0.109
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] GATEWAY_INTERFACE = CGI/1.1
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] wsgi.run_once = False
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] wsgi.errors = <open file '<stderr>', mode 'w' at 0x7f82a3cd31e0>
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] wsgi.multiprocess = False
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] webob.is_body_seekable = True
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] CONTENT_TYPE = application/json
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] HTTP_ACCEPT_ENCODING = gzip, deflate
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi]
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] ******************** REQUEST BODY ********************
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi]
2012-11-15 11:52:57 DEBUG [routes.middleware] Matched PUT /tenants/7d24dc1bb64044c3b887b431b6f8fbe7/users/be199b0acc1e4d73adfd4eed5ab15fb8/roles/OS-KSADM/8de7dabb47f44d47b36f0549b4db4854
2012-11-15 11:52:57 DEBUG [routes.middleware] Route path: '{path_info:.*}', defaults: {'controller': <keystone.contrib.admin_crud.core.CrudExtension object at 0x1d74cd0>}
2012-11-15 11:52:57 DEBUG [routes.middleware] Match dict: {'controller': <keystone.contrib.admin_crud.core.CrudExtension object at 0x1d74cd0>, 'path_info': '/tenants/7d24dc1bb64044c3b887b431b6f8fbe7/users/be199b0acc1e4d73adfd4eed5ab15fb8/roles/OS-KSADM/8de7dabb47f44d47b36f0549b4db4854'}
2012-11-15 11:52:57 DEBUG [routes.middleware] Matched PUT /tenants/7d24dc1bb64044c3b887b431b6f8fbe7/users/be199b0acc1e4d73adfd4eed5ab15fb8/roles/OS-KSADM/8de7dabb47f44d47b36f0549b4db4854
2012-11-15 11:52:57 DEBUG [routes.middleware] Route path: '/tenants/{tenant_id}/users/{user_id}/roles/OS-KSADM/{role_id}', defaults: {'action': u'add_role_to_user', 'controller': <keystone.identity.core.RoleController object at 0x1d748d0>}
2012-11-15 11:52:57 DEBUG [routes.middleware] Match dict: {'action': u'add_role_to_user', 'tenant_id': u'7d24dc1bb64044c3b887b431b6f8fbe7', 'controller': <keystone.identity.core.RoleController object at 0x1d748d0>, 'user_id': u'be199b0acc1e4d73adfd4eed5ab15fb8', 'role_id': u'8de7dabb47f44d47b36f0549b4db4854'}
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] arg_dict: {'tenant_id': u'7d24dc1bb64044c3b887b431b6f8fbe7', 'user_id': u'be199b0acc1e4d73adfd4eed5ab15fb8', 'role_id': u'8de7dabb47f44d47b36f0549b4db4854'}
2012-11-15 11:52:57 DEBUG [keystone.policy.backends.rules] enforce admin_required: {'tenant_id': u'6f53d7b0a37f4245acf577eb4d88869d', 'user_id': u'5e41f77143c5406e9ce6612d80203dcf', u'roles': [u'admin', u'KeystoneServiceAdmin', u'KeystoneAdmin']}
2012-11-15 11:52:57 ERROR [root] 'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/keystone/common/wsgi.py", line 207, in __call__
    result = method(context, **params)
  File "/usr/lib/python2.6/site-packages/keystone/identity/core.py", line 595, in add_role_to_user
    self.token_api.revoke_tokens(context, user_id, tenant_id)
  File "/usr/lib/python2.6/site-packages/keystone/token/core.py", line 48, in revoke_tokens
    for token_id in self.list_tokens(context, user_id, tenant_id):
  File "/usr/lib/python2.6/site-packages/keystone/common/manager.py", line 47, in _wrapper
    return f(*args, **kw)
  File "/usr/lib/python2.6/site-packages/keystone/token/backends/sql.py", line 113, in list_tokens
    if token_ref_dict['tenant'].get('id') != tenant_id:
AttributeError: 'NoneType' object has no attribute 'get'
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] ******************** RESPONSE HEADERS ********************
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] Vary = X-Auth-Token
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] Content-Type = application/json
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] Content-Length = 184
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi]
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] ******************** RESPONSE BODY ********************
2012-11-15 11:52:57 DEBUG [keystone.common.wsgi] {"error": {"message": "An unexpected error prevented the server from fulfilling your request. 'NoneType' object has no attribute 'get'", "code": 500, "title": "Internal Server Error"}}
2012-11-15 11:52:57 DEBUG [eventlet.wsgi.server] 172.23.0.109 - - [15/Nov/2012 11:52:57] "PUT /v2.0/tenants/7d24dc1bb64044c3b887b431b6f8fbe7/users/be199b0acc1e4d73adfd4eed5ab15fb8/roles/OS-KSADM/8de7dabb47f44d47b36f0549b4db4854 HTTP/1.1" 500 332 0.040899

Changed in keystone:
assignee: nobody → irsxyp (irsxyp)
status: New → In Progress
Changed in keystone:
status: In Progress → Fix Committed
Dolph Mathews (dolph)
Changed in keystone:
status: Fix Committed → New
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.