JSON parameter is returned wrongly by the JsonParameter class

Bug #1366798 reported by Endre Karlson
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
High
Endre Karlson

Bug Description

If you use a parameter with the json type and you pass for example {"a": 1} as the value when creating a stack and then do heat stack-show <stack> with that value it will return "{u'a': '1}" instead of '{"a": 1}.

This renders the JsonParameter invalid when it's used by tools that rely on heat preserving the values in the json blob or so.

Revision history for this message
Steve Baker (steve-stevebaker) wrote :

Could you please attach a template which demonstrates this?

Changed in heat:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Steve Baker (steve-stevebaker)
Revision history for this message
jan grant (jan-grant) wrote :

Pretty much any template with a parameter will show this. Look at the returned (http) result from a shack show.

Looks like someone already thought about this - lines 52 and 53 of heat.api.openstack.v1.views.stacks_view has this:

            #elif key == engine_api.STACK_PARAMETERS:
            # return key, json.dumps(value)

Not clear why this was commented out.

Changed in heat:
assignee: Steve Baker (steve-stevebaker) → Endre Karlson (endre-karlson)
status: Triaged → In Progress
Changed in heat:
milestone: none → juno-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

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

commit 391365852740f8312347b326cb8b53720c3df03e
Author: Endre Karlson <email address hidden>
Date: Tue Sep 9 15:18:38 2014 +0200

    Make str(json_param) return string vs python

    Closes-Bug: #1366798

    Change-Id: I3f435932787662cb1bfa91bd5a84c21cf6ddf9d0

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