ironic raises UnicodeEncodeError exception in the non-english language locale

Bug #1437170 reported by Haomeng,Wang
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ironic
Fix Released
Medium
Haomeng,Wang

Bug Description

Once we change the default LANG en_US.UTF-8 others non-english languange and applied the *.po files into /usr/share/locale/ja_JP/LC_MESSAGES folder, run the command with invalid input, such as try to add port which has the existing mac address, will raise below exceptions:

 File "/usr/lib/python2.7/site-packages/pecan/middleware/debug.py", line 291, in __call__
    return self.app(environ, start_response)
  File "/usr/lib/python2.7/site-packages/pecan/middleware/recursive.py", line 56, in __call__
    return self.application(environ, start_response)
  File "/usr/lib/python2.7/site-packages/ironic/api/middleware/parsable_error.py", line 69, in __call__
    app_iter = self.app(environ, replacement_start_response)
  File "/usr/lib/python2.7/site-packages/pecan/core.py", line 805, in __call__
    return super(Pecan, self).__call__(environ, start_response)
  File "/usr/lib/python2.7/site-packages/pecan/core.py", line 654, in __call__
    self.invoke_controller(controller, args, kwargs, state)
  File "/usr/lib/python2.7/site-packages/pecan/core.py", line 554, in invoke_controller
    result = controller(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/wsmeext/pecan.py", line 92, in callfunction
    pecan.conf.get('wsme', {}).get('debug', False)
  File "/usr/lib/python2.7/site-packages/wsme/api.py", line 208, in format_exception
    else str(error)
UnicodeEncodeError: 'ascii' codec can't encode character u'\uff21' in position 3: ordinal not in range(128)

Haomeng,Wang (whaom)
summary: - ironic does not handle utf-8 error message as well
+ ironic raise UnicodeEncodeError for non-english language env
summary: - ironic raise UnicodeEncodeError for non-english language env
+ ironic raises UnicodeEncodeError exception in the non-english language
+ locale
Changed in ironic:
assignee: nobody → Haomeng,Wang (whaom)
status: New → In Progress
importance: Undecided → Medium
Revision history for this message
Haomeng,Wang (whaom) wrote :
Revision history for this message
Haomeng,Wang (whaom) wrote :

But need more fix on our IronicException base class to enable str() call.

Dmitry Tantsur (divius)
Changed in ironic:
milestone: none → kilo-rc1
Revision history for this message
Haomeng,Wang (whaom) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ironic (master)

Reviewed: https://review.openstack.org/168268
Committed: https://git.openstack.org/cgit/openstack/ironic/commit/?id=2b96f0d198cc4890378588836fb71a2249b5f4a4
Submitter: Jenkins
Branch: master

commit 2b96f0d198cc4890378588836fb71a2249b5f4a4
Author: Haomeng, Wang <email address hidden>
Date: Tue Mar 31 04:58:41 2015 +0000

    Fix UnicodeEncodeError issue when the language is not en_US

    Add __str__() method into IronicException base class, and encode to utf-8
    to make sure the wsme api can consume/format it as well.

    Change-Id: I183bbb78d738992ec91dff1ebed698cf84aa06ca
    Closes-Bug: 1437170

Changed in ironic:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in ironic:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ironic:
milestone: kilo-rc1 → 2015.1.0
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.