environment's parameter_defaults not applied some parameter types

Bug #1504137 reported by Yanis Guenane
16
This bug affects 4 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
High
Jiří Stránský
Kilo
Fix Released
Undecided
Steven Hardy
Liberty
Fix Released
High
Unassigned

Bug Description

Context:

 * Current tripleo-heat-templates master + https://review.openstack.org/#/c/232051/
 * Current python-tripleoclient master

Goals:

  Allow a user to pass more than one ntp server url in the command line.
  Possible syntax :

    * --ntp-server 0.test.com,1.test.com
    * --ntp-server 0.test.com --ntp-server 1.test.com (by adding action='append' to the param - https://review.openstack.org/#/c/232075/)

 In order to support such use cases NtpServer has been switched from string to comma_delimited_list[1][2]

# Case 1

If I use directly --ntp-sever, for some reason the value is not passed to the Heat templates. NtpServer end up being empty

## Result 1

[stack@instack ~]$ openstack overcloud deploy --templates --ntp-server 0.test.com,1.test.com
[...]
[stack@instack ~]$ heat stack-show overcloud | grep Ntp
| | "NtpServer": "",

# Case 2

If I use an Heat environment file, the NtpServer is filled acordingly.

## Result 2

[stack@instack ~]$ cat env.yaml
parameters:
  NtpServer: 0.test.com,1.test.com
[stack@instack ~]$ openstack overcloud deploy --templates -e env.yaml
[...]
heat stack-show overcloud | grep Ntp
| | "NtpServer": "0.test.com,1.test.com",

[1] https://review.openstack.org/#/c/232051/
[2] http://docs.openstack.org/developer/heat/template_guide/hot_spec.html#parameters-section

Expected Results:

  Whether using tripleoclient --ntp-server or directly the Heat environment, the value should be passed either way.

Revision history for this message
Jiří Stránský (jistr) wrote :

It is reproducible even with heatclient (with no tripleoclient involved). The parameter_defaults are passed from heatclient correctly though. This is a bug in Heat, it doesn't process environment's parameter_defaults correctly for any value of type comma_delimited_list. I hope i'll have a fix for this.

Changed in tripleo:
assignee: nobody → Jiří Stránský (jistr)
affects: tripleo → heat
summary: - Parameter from tripleoclient not passed to Heat template
+ environment's parameter_defaults not applied for comma delimited lists
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/234055

Changed in heat:
status: New → In Progress
Steven Hardy (shardy)
Changed in heat:
importance: Undecided → High
milestone: none → mitaka-1
tags: added: liberty-backport-potential tripleo
Revision history for this message
Steven Hardy (shardy) wrote :

As reported by dprince, this only affects the top-level stack:

https://bugs.launchpad.net/heat/+bug/1460063

I failed to reproduce that because I tried with "number" not "json" or "comma_delimited_list".

summary: - environment's parameter_defaults not applied for comma delimited lists
+ environment's parameter_defaults not applied some parameter types
Revision history for this message
Steven Hardy (shardy) wrote :

I wrote some tests and this does affect both comma_delimited_list and json parameter types

Changed in heat:
assignee: Jiří Stránský (jistr) → Steven Hardy (shardy)
Changed in heat:
assignee: Steven Hardy (shardy) → Jiří Stránský (jistr)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

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

commit 3827c61b25fa86c1f9882be15caf27d2efa6c4fe
Author: Jiri Stransky <email address hidden>
Date: Tue Oct 13 10:57:06 2015 +0200

    Fix parameter_defaults for comma_delimited_list and json

    When environment of a stack contained a parameter_defaults section with
    a value for a parameter of type comma_delimited_list or json, that default
    didn't get applied unless in a nested stack.

    The issue was that CommaDelimitedListParam contains a variable to cache
    its value, and that cache was only created upon creation of a
    CommaDelimitedListParam object, but it wasn't updated on `set_default`
    method call. The cache now updates on `set_default` too.

    Co-Authored-By: Steven Hardy <email address hidden>
    Change-Id: I85b13a79dbc97a77e20c0d5df8eaf05b3000815e
    Closes-Bug: #1504137

Changed in heat:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (stable/liberty)

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/235349

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

Reviewed: https://review.openstack.org/235349
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=c7795a7be9125f2d42075b127f5696c806380aef
Submitter: Jenkins
Branch: stable/liberty

commit c7795a7be9125f2d42075b127f5696c806380aef
Author: Jiri Stransky <email address hidden>
Date: Tue Oct 13 10:57:06 2015 +0200

    Fix parameter_defaults for comma_delimited_list and json

    When environment of a stack contained a parameter_defaults section with
    a value for a parameter of type comma_delimited_list or json, that default
    didn't get applied unless in a nested stack.

    The issue was that CommaDelimitedListParam contains a variable to cache
    its value, and that cache was only created upon creation of a
    CommaDelimitedListParam object, but it wasn't updated on `set_default`
    method call. The cache now updates on `set_default` too.

    Co-Authored-By: Steven Hardy <email address hidden>
    Change-Id: I85b13a79dbc97a77e20c0d5df8eaf05b3000815e
    Closes-Bug: #1504137
    (cherry picked from commit 3827c61b25fa86c1f9882be15caf27d2efa6c4fe)

tags: added: in-stable-liberty
tags: removed: liberty-backport-potential
Steven Hardy (shardy)
no longer affects: heat/juno
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/244691

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

Reviewed: https://review.openstack.org/244691
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=f47cf4eb4544c75947a8ad635ab4cc6065b1483e
Submitter: Jenkins
Branch: stable/kilo

commit f47cf4eb4544c75947a8ad635ab4cc6065b1483e
Author: Jiri Stransky <email address hidden>
Date: Tue Oct 13 10:57:06 2015 +0200

    Fix parameter_defaults for comma_delimited_list and json

    When environment of a stack contained a parameter_defaults section with
    a value for a parameter of type comma_delimited_list or json, that default
    didn't get applied unless in a nested stack.

    The issue was that CommaDelimitedListParam contains a variable to cache
    its value, and that cache was only created upon creation of a
    CommaDelimitedListParam object, but it wasn't updated on `set_default`
    method call. The cache now updates on `set_default` too.

    Conflicts:
     heat/engine/parameters.py

    Co-Authored-By: Steven Hardy <email address hidden>
    Change-Id: I85b13a79dbc97a77e20c0d5df8eaf05b3000815e
    Closes-Bug: #1504137
    (cherry picked from commit 3827c61b25fa86c1f9882be15caf27d2efa6c4fe)

Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/heat 6.0.0.0b1

This issue was fixed in the openstack/heat 6.0.0.0b1 development milestone.

Changed in heat:
status: Fix Committed → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/heat 5.0.1

This issue was fixed in the openstack/heat 5.0.1 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.