Later specified environment with parameter_defaults values of 0 do not override earlier non-0 values
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Heat |
Fix Released
|
Medium
|
Thomas Herve |
Bug Description
When using multiple environments with -e, and you have a parameter value specified via parameter_defaults, and it's value is 0 (the non-quoted number), it will not override earlier non-zero values.
Here is a test reproducer:
[root@tripleo-09 test]# cat template.yaml
heat_template_
parameters:
param1:
type: number
default: 0
resources:
param1_value:
type: OS::Heat::Value
properties:
value:
{get_param: param1}
[root@tripleo-09 test]# cat env1.yaml
parameter_defaults:
param1: 1
[root@tripleo-09 test]# cat env2.yaml
parameter_defaults:
param1: 0
My create command:
[root@tripleo-09 test]# openstack stack create test --wait -t template.yaml -e env1.yaml -e env2.yaml
Notice env2.yaml is specified last.
The result:
[root@tripleo-09 test]# openstack stack resource show test param1_value
+------
| Field | Value |
+------
| attributes | {u'value': u'1'} |
| creation_time | 2017-03-
| description | |
| links | [{u'href': u'http://
| | est/49406476-
| | {u'href': u'http://
| | st/49406476-
| logical_resource_id | param1_value |
| physical_
| required_by | [] |
| resource_name | param1_value |
| resource_status | CREATE_COMPLETE |
| resource_
| resource_type | OS::Heat::Value |
| updated_time | 2017-03-
+------
The value is 1, when it should be 0.
If you quote the value in env2.yaml so it looks like:
[root@tripleo-09 test]# cat env2.yaml
parameter_defaults:
param1: "0"
Then you get the expected value of 0 after a stack create:
[root@tripleo-09 test]# openstack stack resource show test param1_value
+------
| Field | Value |
+------
| attributes | {u'value': 0} |
| creation_time | 2017-03-
| description | |
| links | [{u'href': u'http://
| | u'http://
| logical_resource_id | param1_value |
| physical_
| required_by | [] |
| resource_name | param1_value |
| resource_status | CREATE_COMPLETE |
| resource_
| resource_type | OS::Heat::Value |
| updated_time | 2017-03-
+------
I'd wager that there is some logic somewhere that is applying some "if" logic to the parameter's value to see if it was specified and the non-quoted 0 evalues to false, so the later value is ignored.
When I was debugging client side, I saw the later value of 0 working as expected after template_
So, the bug must be server side. Note also that if you do a stack create with --dry-run, you will see the wrong value shown in the parameters of the output.
Changed in heat: | |
milestone: | none → pike-1 |
assignee: | nobody → Thomas Herve (therve) |
importance: | Undecided → Medium |
Fix proposed to branch: master /review. openstack. org/440659
Review: https:/