defaults passed as parameters to nested stacks

Bug #1498107 reported by Steven Hardy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
Steven Hardy

Bug Description

There's a confusing misalignment in the properties->parameter conversion for TemplateResource, where we always pass a value via the child_params, even if no property value is passed from the parent template - in this case we should pass nothing, but we extract the parameter default via the generated properties schema, and pass that explicitly to the nested stack:

$ cat parent.yaml
heat_template_version: 2013-05-23
resources:
  test_nested:
    type: nested.yaml

-bash-4.3$ cat nested.yaml
heat_template_version: 2013-05-23
parameters:
  foo_nested:
    type: string
    default: foo
resources:
  test1:
    type: OS::Heat::TestResource
    properties:
      value: foo
      fail: False

-bash-4.3$ heat stack-create x1 -f parent.yaml

-bash-4.3$ heat resource-list x1
+---------------+--------------------------------------+------------------------------------------------------------+-----------------+---------------------+
| resource_name | physical_resource_id | resource_type | resource_status | updated_time |
+---------------+--------------------------------------+------------------------------------------------------------+-----------------+---------------------+
| test_nested | 10a7354d-0857-42d8-8364-1ca5b421c3d3 | file:///opt/stack/heat-templates/patch_updates/nested.yaml | CREATE_COMPLETE | 2015-09-21T17:34:47 |

-bash-4.3$ heat stack-show 10a7354d-0857-42d8-8364-1ca5b421c3d3
+-----------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| Property | Value |
+-----------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| capabilities | [] |
| creation_time | 2015-09-21T17:34:47 |
| description | No description |
| disable_rollback | True |
| id | 10a7354d-0857-42d8-8364-1ca5b421c3d3 |
| links | http://192.168.0.16:8004/v1/63b7b69cab914cb5beeaaee26b933aac/stacks/x1-test_nested-4zisru6vkbvq/10a7354d-0857-42d8-8364-1ca5b421c3d3 (self) |
| notification_topics | [] |
| outputs | [] |
| parameters | { |
| | "OS::project_id": "63b7b69cab914cb5beeaaee26b933aac", |
| | "foo_nested": "foo", |
| | "OS::stack_id": "10a7354d-0857-42d8-8364-1ca5b421c3d3", |
| | "OS::stack_name": "x1-test_nested-4zisru6vkbvq"

Here, we should only see "foo_nested" in the parameters if it's passed from the parent template.

Steven Hardy (shardy)
Changed in heat:
assignee: nobody → Steven Hardy (shardy)
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/225961

Changed in heat:
status: New → In Progress
Changed in heat:
importance: Undecided → Medium
milestone: none → liberty-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

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

commit a7ec465031c3429acfb91e5e4e105726dea607c7
Author: Steven Hardy <email address hidden>
Date: Mon Sep 21 18:25:08 2015 +0100

    Don't pass defaults as parameters for TemplateResource

    The child_params calculation doesn't differentiate parameters
    provided via the properties vs those provided via the template
    defaults (defined in the nested stack template), which leads to
    confusing results when you look at the parameters for the nested
    stack, as the defaults are exposed as parameters passed in
    to the stack, when the parent didn't pass anything via properties.

    Closes-Bug: #1498107
    Change-Id: Ic58cdcd15db09cd8d8d3d52fadfb68aa5709e7d8

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: liberty-rc1 → 5.0.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.