Search code examples
openstack

'unicode' object does not support item assignment (HTTP 400) (Request-ID: xxx)


From the openstack keystone client management doc:

I use openstack user list to check the users in openstack, but get the bellow errors:

'unicode' object does not support item assignment (HTTP 400) (Request-ID: req-ccf9d2b6-0801-45fd-9000-7feb3783eedc)

Why get this issue? its strange.

In the openstack cloud mariadb's keystone database, I selected * from user, get the bellow information:

image description


EDIT

In my openstack cloud host machine's /var/log/keystone.log:

......
2017-09-20 15:15:24.376 9503 INFO keystone.common.wsgi [req-53ed55d1-125f-4ee7-b548-39c8d4e9c062 - - - - -] GET http://controller:35357/v3/users
2017-09-20 15:15:24.416 9503 ERROR keystone.common.wsgi [req-53ed55d1-125f-4ee7-b548-39c8d4e9c062 - - - - -] 'unicode' object does not support item assignment
2017-09-20 15:15:24.416 9503 ERROR keystone.common.wsgi Traceback (most recent call last):
2017-09-20 15:15:24.416 9503 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/common/wsgi.py", line 228, in __call__
2017-09-20 15:15:24.416 9503 ERROR keystone.common.wsgi     result = method(req, **params)
2017-09-20 15:15:24.416 9503 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/common/controller.py", line 235, in wrapper
2017-09-20 15:15:24.416 9503 ERROR keystone.common.wsgi     return f(self, request, filters, **kwargs)
2017-09-20 15:15:24.416 9503 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/identity/controllers.py", line 231, in list_users
2017-09-20 15:15:24.416 9503 ERROR keystone.common.wsgi     return UserV3.wrap_collection(request.context_dict, refs, hints=hints)
2017-09-20 15:15:24.416 9503 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/common/controller.py", line 499, in wrap_collection
2017-09-20 15:15:24.416 9503 ERROR keystone.common.wsgi     cls.wrap_member(context, ref)
2017-09-20 15:15:24.416 9503 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/common/controller.py", line 468, in wrap_member
2017-09-20 15:15:24.416 9503 ERROR keystone.common.wsgi     cls._add_self_referential_link(context, ref)
2017-09-20 15:15:24.416 9503 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/common/controller.py", line 464, in _add_self_referential_link
2017-09-20 15:15:24.416 9503 ERROR keystone.common.wsgi     ref['links']['self'] = cls.base_url(context) + '/' + ref['id']
2017-09-20 15:15:24.416 9503 ERROR keystone.common.wsgi TypeError: 'unicode' object does not support item assignment

Solution

  • At last I find the extra data format of several row is wrong .

    See the user's extra column in the snapshot. the data is like bellow:

    {"email": "xxxx@xx.com", "links":"http://103.x5.xx.1/user_resource/liaoss07"} 
    

    But should pay attention the links should not like that, so, I set the extra to {} which extra is like this abnormal.

    my solution is :

    UPDATE user SET extra='{}' WHERE id=xxx
    

    and you can leave the email in the {} too.