[Bug 1761629] Re: [SRU] unicode error when using old unicode non uuid style user id

Rico Lin rico.lin.guanyu at gmail.com
Mon May 7 07:51:31 UTC 2018


** Changed in: heat
    Milestone: None => no-priority-tag-bugs

-- 
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to Ubuntu Cloud Archive.
https://bugs.launchpad.net/bugs/1761629

Title:
  [SRU] unicode error when using old unicode non uuid style user id

Status in Ubuntu Cloud Archive:
  New
Status in OpenStack Heat(please use StoryBoard instead!!!https://storyboard.openstack.org/#!/project/989 ):
  In Progress
Status in heat package in Ubuntu:
  New

Bug description:
  [Impact]

  When use old non unicode user id, such as Gāo

  heat stack-list shows unicode error

  Affected to
  Xenial, Artful
  UCA Mitaka, Ocata, Pike, Queens

  [Test Case]

  1. deploy openstack env
  2. source novarc ( as admin user ) ( or novarcv3_project as admin )
  3. keystone user-create --name test
  - openstack user create --domain admin_domain test
  4. openstack user set --password-prompt test
  4. log into keystone node and install mysql-client
  5. connect to mysql with keystone user
  6. do below query
  - set foreign_key_checks = 0;
  - update local_user set user_id='Gāo' where user_id='UUID';
  - update user set id='Gāo' where id='UUID';
  - set foreign_key_checks = 1;
  7. keystone user-role-add --user test --tenant admin --role Admin
  - openstack role add --user test --domain admin_domain Admin
  - openstack role add --user test --project [admin project id] Admin
  - openstack role add --user test --project [admin project id] Member
  8. source novarc ( as test user ) ( or novarcv3_project as test user )
  9. heat stack-list

  result is like [Others]

  [Regression]

  This patch fixes simple unicode. but heat api needs to be restarted.
  Could be short outage during restarting.

  [Others]

  Below is test result

  heat --debug stack-list
  DEBUG (session) REQ: curl -g -i -X GET http://10.0.11.184:5000/v2.0 -H "Accept: application/json" -H "User-Agent: python-keystoneclient"
  INFO (connectionpool) Starting new HTTP connection (1): 10.0.11.184
  DEBUG (connectionpool) "GET /v2.0 HTTP/1.1" 200 337
  DEBUG (session) RESP: [200] Content-Length: 337 Vary: X-Auth-Token Keep-Alive: timeout=5, max=100 Server: Apache/2.4.18 (Ubuntu) Connection: Keep-Alive Date: Thu, 05 Apr 2018 21:20:39 GMT x-openstack-request-id: req-df64189d-c865-47fb-b89d-698d61dfafdc Content-Type: [68/1725]
  on/json X-Distribution: Ubuntu
  RESP BODY: {"version": {"status": "stable", "updated": "2014-04-17T00:00:00Z", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v2.0+json"}], "id": "v2.0", "links": [{"href": "http://10.0.11.184:5000/v2.0/", "rel": "self"}, {"href": "ht
  tp://docs.openstack.org/", "type": "text/html", "rel": "describedby"}]}}

  DEBUG (v2) Making authentication request to http://10.0.11.184:5000/v2.0/tokens
  DEBUG (connectionpool) "POST /v2.0/tokens HTTP/1.1" 200 3105
  DEBUG (session) REQ: curl -g -i -X GET http://10.0.11.170:8004/v1/c9c6d2b72f74458bada7f94501369b18/stacks? -H "User-Agent: python-heatclient" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}ad359574acee284a60451f9e2340ec46d6e17728"
  INFO (connectionpool) Starting new HTTP connection (1): 10.0.11.170
  DEBUG (connectionpool) "GET /v1/c9c6d2b72f74458bada7f94501369b18/stacks HTTP/1.1" 400 5508
  DEBUG (session) RESP: [400] Date: Thu, 05 Apr 2018 21:20:39 GMT Content-Length: 5508 Content-Type: application/json; charset=UTF-8 Connection: keep-alive
  RESP BODY: {"explanation": "The server could not comply with the request since it is either malformed or otherwise incorrect.", "code": 400, "error": {"message": "'ascii' codec can't encode character u'\\u0101' in position 1: ordinal not in range(128)", "traceback": "Tracebac
  k (most recent call last):\n  File \"/usr/lib/python2.7/dist-packages/heat/api/middleware/fault.py\", line 163, in process_request\n    return req.get_response(self.application)\n  File \"/usr/lib/python2.7/dist-packages/webob/request.py\", line 1317, in send\n    application
  , catch_exc_info=False)\n  File \"/usr/lib/python2.7/dist-packages/webob/request.py\", line 1281, in call_application\n    app_iter = application(self.environ, start_response)\n  File \"/usr/lib/python2.7/dist-packages/webob/dec.py\", line 130, in __call__\n    resp = self.ca
  ll_func(req, *args, **self.kwargs)\n  File \"/usr/lib/python2.7/dist-packages/webob/dec.py\", line 195, in call_func\n    return self.func(req, *args, **kwargs)\n  File \"/usr/lib/python2.7/dist-packages/oslo_middleware/base.py\", line 114, in __call__\n    response = req.get
  _response(self.application)\n  File \"/usr/lib/python2.7/dist-packages/webob/request.py\", line 1317, in send\n    application, catch_exc_info=False)\n  File \"/usr/lib/python2.7/dist-packages/webob/request.py\", line 1281, in call_application\n    app_iter = application(self
  .environ, start_response)\n  File \"/usr/lib/python2.7/dist-packages/webob/dec.py\", line 130, in __call__\n    resp = self.call_func(req, *args, **self.kwargs)\n  File \"/usr/lib/python2.7/dist-packages/webob/dec.py\", line 195, in call_func\n    return self.func(req, *args,
   **kwargs)\n  File \"/usr/lib/python2.7/dist-packages/oslo_middleware/base.py\", line 114, in __call__\n    response = req.get_response(self.application)\n  File \"/usr/lib/python2.7/dist-packages/webob/request.py\", line 1317, in send\n    application, catch_exc_info=False)\
  n  File \"/usr/lib/python2.7/dist-packages/webob/request.py\", line 1281, in call_application\n    app_iter = application(self.environ, start_response)\n  File \"/usr/lib/python2.7/dist-packages/webob/dec.py\", line 130, in __call__\n    resp = self.call_func(req, *args, **se
  lf.kwargs)\n  File \"/usr/lib/python2.7/dist-packages/webob/dec.py\", line 195, in call_func\n    return self.func(req, *args, **kwargs)\n  File \"/usr/lib/python2.7/dist-packages/heat/common/wsgi.py\", line 584, in __call__\n    response = req.get_response(self.application)\
  n  File \"/usr/lib/python2.7/dist-packages/webob/request.py\", line 1317, in send\n    application, catch_exc_info=False)\n  File \"/usr/lib/python2.7/dist-packages/webob/request.py\", line 1281, in call_application\n    app_iter = application(self.environ, start_response)\n
   File \"/usr/lib/python2.7/dist-packages/webob/dec.py\", line 130, in __call__\n    resp = self.call_func(req, *args, **self.kwargs)\n  File \"/usr/lib/python2.7/dist-packages/webob/dec.py\", line 195, in call_func\n    return self.func(req, *args, **kwargs)\n  File \"/usr/li
  b/python2.7/dist-packages/heat/common/wsgi.py\", line 584, in __call__\n    response = req.get_response(self.application)\n  File \"/usr/lib/python2.7/dist-packages/webob/request.py\", line 1317, in send\n    application, catch_exc_info=False)\n  File \"/usr/lib/python2.7/dis
  t-packages/webob/request.py\", line 1281, in call_application\n    app_iter = application(self.environ, start_response)\n  File \"/usr/lib/python2.7/dist-packages/webob/dec.py\", line 130, in __call__\n    resp = self.call_func(req, *args, **self.kwargs)\n  File \"/usr/lib/py
  thon2.7/dist-packages/webob/dec.py\", line 195, in call_func\n    return self.func(req, *args, **kwargs)\n  File \"/usr/lib/python2.7/dist-packages/keystonemiddleware/auth_token/__init__.py\", line 467, in __call__\n    response = req.get_response(self._app)\n  File \"/usr/li
  b/python2.7/dist-packages/webob/request.py\", line 1317, in send\n    application, catch_exc_info=False)\n  File \"/usr/lib/python2.7/dist-packages/webob/request.py\", line 1281, in call_application\n    app_iter = application(self.environ, start_response)\n  File \"/usr/lib/
  python2.7/dist-packages/webob/dec.py\", line 130, in __call__\n    resp = self.call_func(req, *args, **self.kwargs)\n  File \"/usr/lib/python2.7/dist-packages/webob/dec.py\", line 195, in call_func\n    return self.func(req, *args, **kwargs)\n  File \"/usr/lib/python2.7/dist-
  packages/heat/common/wsgi.py\", line 581, in __call__\n    response = self.process_request(req)\n  File \"/usr/lib/python2.7/dist-packages/heat/common/context.py\", line 311, in process_request\n    project_domain_id=project_domain_id)\n  File \"/usr/lib/python2.7/dist-packag
  es/heat/common/context.py\", line 256, in make_context\n    return self.ctxcls(*args, **kwargs)\n  File \"/usr/lib/python2.7/dist-packages/heat/common/context.py\", line 109, in __init__\n    self.is_admin = self.policy.check_is_admin(self)\n  File \"/usr/lib/python2[40/1725]
  ackages/heat/common/policy.py\", line 88, in check_is_admin\n    return self._check(context, 'context_is_admin', target={}, exc=None)\n  File \"/usr/lib/python2.7/dist-packages/heat/common/policy.py\", line 65, in _check\n    credentials = context.to_dict()\n  File \"/usr/lib
  /python2.7/dist-packages/heat/common/context.py\", line 127, in to_dict\n    tenant=self.tenant_id or '-')\nUnicodeEncodeError: 'ascii' codec can't encode character u'\\u0101' in position 1: ordinal not in range(128)\n", "type": "UnicodeEncodeError"}, "title": "Bad Request"}

  Traceback (most recent call last):
    File "/usr/bin/heat", line 10, in <module>
      sys.exit(main())
    File "/usr/lib/python2.7/dist-packages/heatclient/shell.py", line 702, in main
      HeatShell().main(args)
    File "/usr/lib/python2.7/dist-packages/heatclient/shell.py", line 652, in main
      args.func(client, args)
    File "/usr/lib/python2.7/dist-packages/heatclient/v1/shell.py", line 675, in do_stack_list
      utils.print_list(stacks, fields, sortby_index=sortby_index)
    File "/usr/lib/python2.7/dist-packages/heatclient/openstack/common/cliutils.py", line 169, in print_list
      for o in objs:
    File "/usr/lib/python2.7/dist-packages/heatclient/v1/stacks.py", line 127, in paginate
      stacks = self._list(url, 'stacks')
    File "/usr/lib/python2.7/dist-packages/heatclient/openstack/common/apiclient/base.py", line 135, in _list
      body = self.client.get(url).json()
    File "/usr/lib/python2.7/dist-packages/keystoneclient/adapter.py", line 176, in get
      return self.request(url, 'GET', **kwargs)
    File "/usr/lib/python2.7/dist-packages/heatclient/common/http.py", line 311, in request
      raise exc.from_response(resp)
  heatclient.exc.HTTPBadRequest: ERROR: 'ascii' codec can't encode character u'\u0101' in position 1: ordinal not in range(128)

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-archive/+bug/1761629/+subscriptions



More information about the Ubuntu-openstack-bugs mailing list