string parameter can't accept unicode

Bug #1330370 reported by Ethan Lynn
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
Ethan Lynn
Icehouse
Fix Released
Medium
Unassigned
python-heatclient
Fix Released
Medium
Ethan Lynn

Bug Description

If a string parameter receive a unicode, a unicodeerror will raise.
heat stack-create -f ~/Downloads/mytemplates/bug/privateipaddress.template -P "paratest=test♥" test
ERROR: Remote error: UnicodeEncodeError 'ascii' codec can't encode character u'\u2665' in position 4: ordinal not in range(128)

Trace:
2014-06-16 15:20:46.920 ERROR heat.openstack.common.rpc.amqp [req-4f5062cb-e912-4eb8-b27b-7faab90e3581 None demo] Exception during message handling
2014-06-16 15:20:46.920 TRACE heat.openstack.common.rpc.amqp Traceback (most recent call last):
2014-06-16 15:20:46.920 TRACE heat.openstack.common.rpc.amqp File "/opt/stack/heat/heat/openstack/common/rpc/amqp.py", line 462, in _process_data
2014-06-16 15:20:46.920 TRACE heat.openstack.common.rpc.amqp **args)
2014-06-16 15:20:46.920 TRACE heat.openstack.common.rpc.amqp File "/opt/stack/heat/heat/openstack/common/rpc/dispatcher.py", line 172, in dispatch
2014-06-16 15:20:46.920 TRACE heat.openstack.common.rpc.amqp result = getattr(proxyobj, method)(ctxt, **kwargs)
2014-06-16 15:20:46.920 TRACE heat.openstack.common.rpc.amqp File "/opt/stack/heat/heat/engine/service.py", line 61, in wrapped
2014-06-16 15:20:46.920 TRACE heat.openstack.common.rpc.amqp return func(self, ctx, *args, **kwargs)
2014-06-16 15:20:46.920 TRACE heat.openstack.common.rpc.amqp File "/opt/stack/heat/heat/engine/service.py", line 393, in show_stack
2014-06-16 15:20:46.920 TRACE heat.openstack.common.rpc.amqp return [format_stack_detail(s) for s in stacks]
2014-06-16 15:20:46.920 TRACE heat.openstack.common.rpc.amqp File "/opt/stack/heat/heat/engine/service.py", line 391, in format_stack_detail
2014-06-16 15:20:46.920 TRACE heat.openstack.common.rpc.amqp return api.format_stack(stack)
2014-06-16 15:20:46.920 TRACE heat.openstack.common.rpc.amqp File "/opt/stack/heat/heat/engine/api.py", line 91, in format_stack
2014-06-16 15:20:46.920 TRACE heat.openstack.common.rpc.amqp api.STACK_PARAMETERS: stack.parameters.map(str),
2014-06-16 15:20:46.920 TRACE heat.openstack.common.rpc.amqp File "/opt/stack/heat/heat/engine/parameters.py", line 447, in map
2014-06-16 15:20:46.920 TRACE heat.openstack.common.rpc.amqp for n, p in self.params.iteritems() if filter_func(p))
2014-06-16 15:20:46.920 TRACE heat.openstack.common.rpc.amqp File "/opt/stack/heat/heat/engine/parameters.py", line 447, in <genexpr>
2014-06-16 15:20:46.920 TRACE heat.openstack.common.rpc.amqp for n, p in self.params.iteritems() if filter_func(p))
2014-06-16 15:20:46.920 TRACE heat.openstack.common.rpc.amqp File "/opt/stack/heat/heat/engine/parameters.py", line 266, in __str__
2014-06-16 15:20:46.920 TRACE heat.openstack.common.rpc.amqp return str(value)
2014-06-16 15:20:46.920 TRACE heat.openstack.common.rpc.amqp UnicodeEncodeError: 'ascii' codec can't encode character u'\u2665' in position 4: ordinal not in range(128)
2014-06-16 15:20:46.920 TRACE heat.openstack.common.rpc.amqp
2014-06-16 15:20:46.923 ERROR heat.openstack.common.rpc.common [req-4f5062cb-e912-4eb8-b27b-7faab90e3581 None demo] Returning exception 'ascii' codec can't encode character u'\u2665' in position 4: ordinal not in range(128) to caller

Ethan Lynn (ethanlynn)
Changed in heat:
assignee: nobody → Ethan Lynn (ethanlynn)
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/100178

Changed in heat:
status: New → In Progress
Revision history for this message
Ethan Lynn (ethanlynn) wrote :
Changed in python-heatclient:
assignee: nobody → Ethan Lynn (ethanlynn)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

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

commit 7b8d32d58195a2b9098c837fe997d334e2529b8d
Author: Ethan Lynn <email address hidden>
Date: Mon Jun 16 13:57:50 2014 +0800

    Fix String Parameter Receive a unicode

    Add unicode encode to parameter to make sure unicode will be
    accepted correctly.

    Change-Id: Idc9afad7971eaf0320d719946a3f09b8e15c1479
    Closes-Bug: #1330370

Changed in heat:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (stable/icehouse)

Fix proposed to branch: stable/icehouse
Review: https://review.openstack.org/101418

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (stable/icehouse)

Reviewed: https://review.openstack.org/101418
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=57f8eaa19b27513aa3f268775c84340187bc8ef9
Submitter: Jenkins
Branch: stable/icehouse

commit 57f8eaa19b27513aa3f268775c84340187bc8ef9
Author: Ethan Lynn <email address hidden>
Date: Mon Jun 16 13:57:50 2014 +0800

    Fix String Parameter Receive a unicode

    Add unicode encode to parameter to make sure unicode will be
    accepted correctly.

    Change-Id: Idc9afad7971eaf0320d719946a3f09b8e15c1479
    Closes-Bug: #1330370
    (cherry picked from commit 7b8d32d58195a2b9098c837fe997d334e2529b8d)

tags: added: in-stable-icehouse
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-heatclient (master)

Reviewed: https://review.openstack.org/100191
Committed: https://git.openstack.org/cgit/openstack/python-heatclient/commit/?id=99b1536785ef986acf053fa958f51fb24923f171
Submitter: Jenkins
Branch: master

commit 99b1536785ef986acf053fa958f51fb24923f171
Author: Ethan Lynn <email address hidden>
Date: Mon Jun 16 16:33:23 2014 +0800

    Fix unicode display in parameters

    When parameters contain unicode, stack-show will display unicode
    as '\u2665'. It's not easy to read by human.
    This change will change '\u2665' to readable unicode char '♥' when
    display to users.

    Change-Id: I00a74943138b292b71f848966ee64a658be64bc2
    Partial-Bug: #1330370

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