template_format_parse error message mangled by i8n

Bug #1384669 reported by Steven Hardy
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Undecided
Sergey Kraynev

Bug Description

When running this test, we get a failure because the i8n _() wrapper mangles the content of the message:

python -m testtools.run heat.tests.test_api_openstack_v1.InstantiationDataTest.test_format_parse_invalid_message

Traceback (most recent call last):
  File "heat/tests/test_api_openstack_v1.py", line 92, in test_format_parse_invalid_message
    self.assertIn('line 4, column 3', six.text_type(parse_ex))
  File "/usr/lib/python2.7/site-packages/testtools/testcase.py", line 354, in assertIn
    self.assertThat(haystack, Contains(needle), message)
  File "/usr/lib/python2.7/site-packages/testtools/testcase.py", line 433, in assertThat
    raise mismatch_error
MismatchError: 'line 4, column 3' not in u'foo not in valid format: Error parsing template: while parsing a block mapping\ndid not find expected key\n in "None", line 1, column 1'

This seems to be caused by this code:

heat/common/template_format.py

except yaml.YAMLError as yea:
            msg = _('Error parsing template: %s') % yea
            raise ValueError(msg)

putting some debug prints around the msg line shows this:

SHDEBUG yea = while parsing a block mapping in "<byte string>", line 4, column 3 did not find expected key in "<byte string>", line 6, column 5
SHDEBUG msg = Error parsing template: while parsing a block mapping did not find expected key in "None", line 1, column 1

Revision history for this message
Sergey Kraynev (skraynev) wrote :

P.s. it's reproduced only on local environment , not on Jenkins gates

Changed in heat:
assignee: nobody → Sergey Kraynev (skraynev)
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

Fix proposed to branch: master
Review: https://review.openstack.org/130808

Changed in heat:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/130808
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=1fd3d34a27816190c2d8db68e6f8da0fd9af0f9f
Submitter: Jenkins
Branch: master

commit 1fd3d34a27816190c2d8db68e6f8da0fd9af0f9f
Author: Sergey Kraynev <email address hidden>
Date: Fri Oct 24 10:25:48 2014 -0400

    Fix translating error in unittests

    Change-Id: I1d64143a4bf8ddcf2ebe4a0bda049e962f3912e5
    Closes-Bug: #1384669

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