cfn-json2yaml number key

Bug #1286380 reported by Kevin Fox
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Heat Templates
In Progress
Undecided
Unassigned
OpenStack Heat
Fix Released
Low
Kent Wang

Bug Description

I ran cfn-json2yaml on:
https://raw.github.com/EMSL-MSC/heat-templates/master/cfn/F19/MongoDB_ConfigSvr.template

It generates valid yaml, but the hot file it generates does not work.
The Mappings it generates has 64 and not '64'. Since 64 in yaml is a number not a string, when the template tries and looks up '64' in the mapping it fails to find it since it is not a string.

It generates something like:
https://github.com/EMSL-MSC/heat-templates/blob/6cf61d0082570933eed75f618373eebf3789296c/hot/MongoDB/MongoDB_ConfigSvr.yaml

But I had to patch it to work. The patch looks like:
https://github.com/EMSL-MSC/heat-templates/commit/1b5fe6e7b4adce0ddfd4e415a799097fca22fa8b

Changed in heat-templates:
assignee: nobody → Petersingh Anburaj (petersingh-anburaj)
status: New → Confirmed
Revision history for this message
Petersingh Anburaj (petersingh-anburaj) wrote :

For the above Bug of heat-template need to do changes in "heat/common/template_format.py" file of heat

Changed in heat:
assignee: nobody → Petersingh Anburaj (petersingh-anburaj)
status: New → Confirmed
Revision history for this message
Petersingh Anburaj (petersingh-anburaj) wrote :

Propossed the Code Change:
https://review.openstack.org/102229

Changed in heat:
status: Confirmed → In Progress
Revision history for this message
Petersingh Anburaj (petersingh-anburaj) wrote :

Need to do changes in "heat/common/template_format.py" file of heat
Propossed the Code Change:
https://review.openstack.org/102229

Changed in heat-templates:
status: Confirmed → In Progress
Revision history for this message
Angus Salkeld (asalkeld) wrote :

Removing assignee to give someone else a go.

Changed in heat:
assignee: Petersingh Anburaj (petersingh-anburaj) → nobody
importance: Undecided → Low
Changed in heat-templates:
assignee: Petersingh Anburaj (petersingh-anburaj) → nobody
Angus Salkeld (asalkeld)
Changed in heat:
status: In Progress → Triaged
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on heat (master)

Change abandoned by Angus Salkeld (<email address hidden>) on branch: master
Review: https://review.openstack.org/102229
Reason: adandoning old reviews, feel free to repost this if you want to get it merged.

Kent Wang (k.wang)
Changed in heat:
assignee: nobody → Kent Wang (k.wang)
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/191311

Changed in heat:
status: Triaged → In Progress
Changed in heat:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in heat:
milestone: none → liberty-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in heat:
milestone: liberty-2 → 5.0.0
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to heat (master)

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

commit eb8b9b86dfa779e96bb6dc2b8e06ae4f44f314d0
Author: Zane Bitter <email address hidden>
Date: Tue Aug 16 17:44:36 2016 -0400

    Parse JSON as JSON when converting to YAML

    The convert_json_to_yaml function is a horror of almost Lovecraftian
    propportions, designed to convert from JSON to YAML without changing the
    order of keys in the file.

    The fix for bug 1286380 (which appears to be resolved in the latest
    versions of PyYaml anyway) means that, if this was not corrupting data
    before, then it certainly can now.

    This patch takes advantage of the fact that we no longer support Python 2.6
    to just parse the JSON data as JSON (instead of YAML) using the
    object_pairs_hook to ensure that the output order does not change.

    Change-Id: I4b09b4c913ec6f8d9c4b7017e3a7a5b7166cf78e
    Related-Bug: #1286380
    Closes-Bug: #1613881

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.