handle_signal FAILED raises UnicodeError

Bug #1332355 reported by Steve McLellan
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
High
Steve McLellan

Bug Description

Problem:

If a signal reports a failure condition, line 458 of engine/resources/software_config/software_deployment.py attempts to create a string representing the failure condition with the following:

  status_reason = ', '.join([' : '.join((k, str(status_reasons[k])))
                                        for k in status_reasons])

This raises an error `Expected exception during message handling (UnicodeError: Message objects do not support str() because they may contain non-ascii characters. Please use unicode() or translate() instead.)`

Expected: Stack is marked as failure with the reason from the signal.

Actual: Stack is left In Progress.

Solution:

The Message in question is a translateable message from gettextutils, and the error condition was introduced in April 2014 for a logging issue (line 326 of gettextutils). The solution in this instance appears to be to translate status_reason, though I can't tell if they are not guaranteed to be Messages in all cases.

Full stack:

2014-06-19 22:25:47.804 ERROR heat.engine.resource signal SoftwareDeployment "test-deployment" [2600d15d-7678-4ee3-83a4-53ce1b0669ce] Stack "quick-env-8" [fb72c08c-a123-4455-bb96-dff3170f06b2] : Message objects do not support str() because they may contain non-ascii characters. Please use unicode() or translate() instead.
2014-06-19 22:25:47.804 TRACE heat.engine.resource Traceback (most recent call last):
2014-06-19 22:25:47.804 TRACE heat.engine.resource File "/opt/stack/heat/heat/engine/resource.py", line 887, in signal
2014-06-19 22:25:47.804 TRACE heat.engine.resource self.handle_signal(details)
2014-06-19 22:25:47.804 TRACE heat.engine.resource File "/opt/stack/heat/heat/engine/resources/software_config/software_deployment.py", line 459, in handle_signal
2014-06-19 22:25:47.804 TRACE heat.engine.resource for k in status_reasons])
2014-06-19 22:25:47.804 TRACE heat.engine.resource File "/opt/stack/heat/heat/openstack/common/gettextutils.py", line 333, in __str__
2014-06-19 22:25:47.804 TRACE heat.engine.resource raise UnicodeError(msg)
2014-06-19 22:25:47.804 TRACE heat.engine.resource UnicodeError: Message objects do not support str() because they may contain non-ascii characters. Please use unicode() or translate() instead.

Changed in heat:
status: New → Triaged
importance: Undecided → High
Steve McLellan (sjmc7)
Changed in heat:
assignee: nobody → Steve McLellan (sjmc7)
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/101663

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

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

commit dc00097426329e8de15e166503df13fe2295acd9
Author: Steve McLellan <email address hidden>
Date: Fri Jun 20 14:52:38 2014 -0500

    handle_signal to handle translated error msgs

    Heat software config deployments, when they fail, in some
    circumstances pass translateable Messages as their error output.

    Patch converts messages to unicode rather than str.

    Change-Id: Idd325c80b68a69d11cea306bd6980518f0948196
    Closes-Bug: #1332355

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