VimExceptions need to support i18n objects

Bug #1374210 reported by Davanum Srinivas (DIMS)
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Invalid
Medium
James Carey
oslo.vmware
Fix Released
High
James Carey

Bug Description

When lazy is enabled the i18n translation object does not support
str() which causes failures like:
  UnicodeError: Message objects do not support str() because they may
  contain non-ascii characters. Please use unicode() or translate()
  instead.

Tags: vmware
tags: added: vmware
Changed in nova:
status: New → Confirmed
Changed in oslo.vmware:
status: New → Confirmed
Changed in nova:
importance: Undecided → Medium
Changed in oslo.vmware:
importance: Undecided → High
Changed in nova:
assignee: nobody → James Carey (jecarey)
Changed in oslo.vmware:
assignee: nobody → James Carey (jecarey)
milestone: none → next-kilo
Revision history for this message
James Carey (jecarey) wrote :

Here is the failure when i18n lazy translation is enabled in Nova (note not enabled in Juno):

nova.tests.virt.vmwareapi.test_driver_api.VMwareSudsTest.test_exception_with_deepcopy
-------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):
      File "nova/tests/virt/vmwareapi/test_driver_api.py", line 113, in test_exception_with_deepcopy
        copy.deepcopy, self.vim)
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 420, in assertRaises
        self.assertThat(our_callable, matcher)
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 431, in assertThat
        mismatch_error = self._matchHelper(matchee, matcher, message, verbose)
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 481, in _matchHelper
        mismatch = matcher.match(matchee)
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/testtools/matchers/_exception.py", line 108, in match
        mismatch = self.exception_matcher.match(exc_info)
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/testtools/matchers/_higherorder.py", line 62, in match
        mismatch = matcher.match(matchee)
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 412, in match
        reraise(*matchee)
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/testtools/matchers/_exception.py", line 101, in match
        result = matchee()
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 965, in __call__
        return self._callable_object(*self._args, **self._kwargs)
      File "/usr/lib/python2.7/copy.py", line 174, in deepcopy
        y = copier(memo)
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/oslo/vmware/service.py", line 201, in request_handler
        _("No such SOAP method %s.") % attr_name, excep)
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/oslo/vmware/exceptions.py", line 52, in __init__
        self.msg = str(message)
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/oslo/i18n/_message.py", line 167, in __str__
        raise UnicodeError(msg)
    UnicodeError: Message objects do not support str() because they may contain non-ascii characters. Please use unicode() or translate() instead.

Changed in oslo.vmware:
status: Confirmed → Fix Committed
Changed in oslo.vmware:
status: Fix Committed → Fix Released
Changed in nova:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers