Resource group 'attributes' output should be a Json

Bug #1394094 reported by Qiming Teng
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Invalid
Medium
Song Li
python-heatclient
Fix Released
Medium
Song Li

Bug Description

Currently, the 'attributes' output from ResourceGroup is a python dict. This won't be a problem if the output is dumped using CLI because heatclient is dumping it as a valid Json.

{ '0': 'value1', '1': 'value2'}

However, there are possibilities the output is referenced directly inside a template. To meet those use cases, it has better be converted into a valid Json in the first place, i.e.

{"0": "value1", "1": "value2"}

Steven Hardy (shardy)
Changed in heat:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Steve Baker (steve-stevebaker) wrote :

but {get_attr} lets you index any element of a complex structure. This looks invalid to me.

http://docs.openstack.org/developer/heat/template_guide/hot_spec.html#get-attr

Song Li (lisong-cruise)
Changed in heat:
assignee: nobody → Song Li (lisong-cruise)
Revision history for this message
Song Li (lisong-cruise) wrote :

In the bug description, these words, "Currently, the 'attributes' output from ResourceGroup is a python dict. This won't be a problem if the output is dumped using CLI because heatclient is dumping it as a valid Json."

I am afraid that the output is format by REST response, rather than heatclient. When I am using heat --debug stack-show xxxxxxxxxxx
The response from Heat API is returning JSON, so I think this will not affect the users that only using REST.

When the output is used by template, I think get_attr might will be convenient enough. (As @Steve said)

@Qiming, Do you agree with us?

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

I've moved this bug to python-heatclient. The resource-show command needs to appropriately format the 'attributes' value, maybe as indented json.

Changed in python-heatclient:
status: New → Triaged
importance: Undecided → Medium
assignee: nobody → Song Li (lisong-cruise)
Changed in heat:
status: Triaged → Invalid
Revision history for this message
Song Li (lisong-cruise) wrote :

Hi Steve, the output format of the attributes in resource-show command is not so friendly, it print the raw JSON String. I will try to format that in indented JSON like the format of "outputs" in stack-show.

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

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

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

Reviewed: https://review.openstack.org/143371
Committed: https://git.openstack.org/cgit/openstack/python-heatclient/commit/?id=8947cd3e5924d44846a8fc7c68266d4ccee0c3cc
Submitter: Jenkins
Branch: master

commit 8947cd3e5924d44846a8fc7c68266d4ccee0c3cc
Author: Song Li <email address hidden>
Date: Mon Dec 22 14:11:57 2014 +0800

    Format attributes as JSON in resource-show output

    Format the attributes as indented JSON to improve the output format
    of command resource-show.

    Change-Id: I5a72f12c7710c782cbc0e89483d271ab86bddc3c
    Closes-Bug: #1394094

Changed in python-heatclient:
status: In Progress → Fix Committed
Changed in python-heatclient:
milestone: none → v0.3.0
Changed in python-heatclient:
status: Fix Committed → 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.