allowed value of number parameter does not work

Bug #1321540 reported by xiejunan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
Thomas Spatzier

Bug Description

During coverage tests for Heat , i found allowed_value constraint do not work for number type. Following is my template:

 heat_template_version: 2013-05-23
description: Simple template to deploy a single compute instance
parameters:
 para_number:
   type: number
   label: test number
   description: number description
   hidden: false
   default: 80
   constraints:
     - allowed_values: [80,8080,8888]

resources:
 my_instance1:
  type: OS::Nova::Server
  properties:
   key_name: heat_key
   image: cirros-0.3.1-x86_64-uec
   flavor: m1.tiny

outputs:
  ip_address:
    description: ip address
    value: { get_attr: [my_instance1,first_address]}
  para_str:
    description: para_str
    value: { get_param: para_str }
  para_number:
    description: para_number
    value: { get_param: para_number }

when i create stack assignning 8080 to para_number ( client command: heat stack-create mystack -f para_number.yaml -P"para_number=8080"), client will produce error message:
     Error: "8080" is not a allowed value [80,8080,8888]

summary: - allowed vlaue of number parameter do not work
+ allowed value of number parameter does not work
Revision history for this message
Thomas Herve (therve) wrote :

We fail to change the integer to a number. It might a recent regression, I'm pretty sure it used to work.

Changed in heat:
importance: Undecided → Medium
milestone: none → juno-1
status: New → Confirmed
assignee: nobody → Thomas Herve (therve)
Changed in heat:
assignee: Thomas Herve (therve) → Thomas Spatzier (thomas-spatzier)
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/94641

Changed in heat:
status: Confirmed → In Progress
Thierry Carrez (ttx)
Changed in heat:
milestone: juno-1 → juno-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

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

commit 43c33fff9b0cc023e921d4ac3cb8a5241e38694c
Author: Thomas Spatzier <email address hidden>
Date: Wed May 21 16:36:59 2014 +0200

    Respect schema data type in constraint validation

    This patch makes Constraint objects aware of the data type of the
    owning Schema object so constraint validation can apply potential
    type casts based on the data type.
    This is especially useful and necessary for an AllowedValues
    constraint and numeric values, where items may be defined as
    strings or numbers and cause comparison issues with user values
    at runtime.

    Change-Id: Id1884b4968993fc9356e7ba4ad03dced4cd00d4e
    Closes-Bug: #1321540

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