Error during pass 0 parameter to resource_group

Bug #1423946 reported by Sergey Kraynev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
Sergey Kraynev

Bug Description

I try to create follow template:

heat_template_version: 2013-05-23

parameters:

  instance_type:
    type: string
    description: Type of the instance to be created.
    default: m1.heat
  location:
    type: string
    default: http://download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img
  disk:
    type: number
    default: 0

resources:

  group_of_volumes:
    type: OS::Heat::ResourceGroup
    properties:
      count: 1
      resource_def:
        type: nested_stack.yaml
        properties:
          instance_type: {get_param: instance_type}
          disk: {get_param: disk}
          location: {get_param: location}

Where nested_stack.yaml:

heat_template_version: 2013-05-23

parameters:

  disk:
    type: number
  d_format:
    type: string
    default: qcow2
  c_format:
    type: string
    default: bare
  location:
    type: string

  instance_type:
    type: string

resources:
  image:
    type: OS::Glance::Image
    properties:
      min_disk: {get_param: disk}
      disk_format: {get_param: d_format}
      container_format: {get_param: c_format}
      location: {get_param: location}

  instance:
    type: OS::Nova::Server
    properties:
      image: {get_resource: image}
      flavor: {get_param: instance_type}

If I use default value of disk (i.e. 0), it produce error:

skr ~ $ heat event-list demos
+------------------+--------------------------------------+-----------------------------------------------------------------------+--------------------+----------------------+
| resource_name | id | resource_status_reason | resource_status | event_time |
+------------------+--------------------------------------+-----------------------------------------------------------------------+--------------------+----------------------+
| group_of_volumes | e86c6c4b-9c87-4e87-9da1-5dafca688cdc | StackValidationFailed: Property error : 0: Property disk not assigned | CREATE_FAILED | 2015-02-20T13:36:02Z |
| group_of_volumes | 39729043-4e21-4b6a-937a-16dbed297238 | state changed | CREATE_IN_PROGRESS | 2015-02-20T13:36:02Z |
+------------------+--------------------------------------+-----------------------------------------------------------------------+--------------------+----------------------+

Same template works with disk equals any other not 0 value.

I suppose, that it should works for cases when parameter equal 0, [] or {}, because in some situations user want
apparently specify empty value or not limiting in case of flavor size as example.

Angus Salkeld (asalkeld)
Changed in heat:
status: New → Triaged
importance: Undecided → Medium
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/159059

Changed in heat:
status: Triaged → In Progress
Changed in heat:
assignee: Sergey Kraynev (skraynev) → Angus Salkeld (asalkeld)
Changed in heat:
assignee: Angus Salkeld (asalkeld) → Sergey Kraynev (skraynev)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

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

commit 04e68f87ca0cdb94f47ca156d2363de4932ec911
Author: Angus Salkeld <email address hidden>
Date: Wed Feb 25 21:01:12 2015 +1000

    Add ability to pass 0, "", {} or [] as a parameter

    Normal issues with using values as booleans.

    Closes-Bug: #1423946
    Closes-Bug: #1425238
    Co-Authored-by: Sergey Kraynev <email address hidden>
    Co-Authored-by: Angus Salkeld <email address hidden>
    Change-Id: I9c6cd01ca722a65d3de6f28732ae07caefaa6cd8

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: kilo-3 → 2015.1.0
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.