Passing number and bool literals to string properties fails with Property error

Bug #1367375 reported by Tomas Sedovic
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Undecided
Jan Provaznik
Juno
Fix Released
Undecided
Steven Hardy

Bug Description

This template:

    heat_template_version: 2014-10-16
    resources:
      my_server:
        type: OS::Nova::Server
        properties:
          key_name: 42
          image: fedora-20.x86_64

Fails to launch with this message:
    ERROR: Property error : my_server: key_name Value must be a string

YAML treats `42` as a number, but the `key_name` expects a string. The same behaviour occurs with true/false values and it also occurs when we put these as `default` values of `type: string` parameters.

Wrapping the values in quotes fixes the issue and is probably the recommended solution. But I have seen a few people get tripped up by this and since Heat knows to expect a string there, it should be safe to cast numbers and bools.

Changed in heat:
assignee: nobody → Ishant Tyagi (ishant-tyagi)
Changed in heat:
assignee: Ishant Tyagi (ishant-tyagi) → Razumovsky Peter (prazumovsky)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on heat (master)

Change abandoned by Peter Razumovsky (<email address hidden>) on branch: master
Review: https://review.openstack.org/122352

Changed in heat:
assignee: Razumovsky Peter (prazumovsky) → nobody
Changed in heat:
assignee: nobody → Jan Provaznik (jan-provaznik)
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/125356

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

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

commit 48214930bbec2e09569d848fa5b8759c429acd5b
Author: Jan Provaznik <email address hidden>
Date: Wed Oct 1 15:26:45 2014 +0200

    Convert bool/int values into string for string properties

    Instead of rising an exception, boolean and integer values are
    converted into string if string is expected.

    Change-Id: I1e0014576c4df447bfa1595c530f1e24f411195d
    Closes-Bug: #1367375

Changed in heat:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in heat:
milestone: none → kilo-1
status: Fix Committed → Fix Released
Steven Hardy (shardy)
tags: added: juno-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (stable/juno)

Fix proposed to branch: stable/juno
Review: https://review.openstack.org/151180

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

Reviewed: https://review.openstack.org/151180
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=b52c916da0759fb5b310ecbcce5db2608b67fdb1
Submitter: Jenkins
Branch: stable/juno

commit b52c916da0759fb5b310ecbcce5db2608b67fdb1
Author: Jan Provaznik <email address hidden>
Date: Wed Oct 1 15:26:45 2014 +0200

    Convert bool/int values into string for string properties

    Instead of rising an exception, boolean and integer values are
    converted into string if string is expected.

    Change-Id: I1e0014576c4df447bfa1595c530f1e24f411195d
    Closes-Bug: #1367375
    (cherry picked from commit 48214930bbec2e09569d848fa5b8759c429acd5b)

Thierry Carrez (ttx)
Changed in heat:
milestone: kilo-1 → 2015.1.0
Zane Bitter (zaneb)
tags: added: in-stable-juno
removed: juno-backport-potential
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.