'unicode'对象不支持项目分配(HTTP 400)(Request-ID:xxx)

时间:2017-09-20 03:55:42

标签: openstack

来自openstack keystone client management doc

我使用openstack user list检查openstack中的用户,但收到以下错误:

  

'unicode'对象不支持项目分配(HTTP 400)(请求ID:req-ccf9d2b6-0801-45fd-9000-7feb3783eedc)

为什么会遇到这个问题?很奇怪。

在openstack cloud mariadb的keystone数据库中,selected * from user,获取以下信息:

image description

修改

在我的openstack云主机中/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

1 个答案:

答案 0 :(得分:0)

最后我发现几行的额外数据格式是错误的。

查看快照中用户的额外列。数据如下:

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

但是应该注意links不应该这样,所以,我将额外设置为{},这更像是这种异常。

我的解决方案是:

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

您也可以将电子邮件保留在{}