repeat function argument is evaluated too eagerly
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Heat |
Fix Released
|
High
|
Zane Bitter |
Bug Description
Prior to the fix for bug 1466748, the repeat function did not support using an intrinsic function as a top-level definition of one of the for_each keys, due to type checking of arguments. Specifically this did not work:
repeat:
for_each:
template: ...
I believe this was an oversight in the original implementation.
The fix for bug 1466748 fixes this by resolving function references at parse time, so that the get_param intrinsic above resolves to a list before it is typed checked.
Unfortunately this is an incorrect way of handling it, because it works only for functions (like get_param) that are resolvable at parse time. So a user is still unable to use something like:
repeat:
for_each:
template: ...
but, worse than that, there is a regression because constructs that would previously have worked fine, like:
repeat:
for_each:
- {get_attr: [resource1, network]}
- {get_attr: [resource2, network]}
template: ...
are now broken - not necessarily with an error, but by simply returning the wrong data (get_attr will evaluate to None at parse time in many cases).
The correct solution, and the one consistent with other intrinsic functions, is to delay the resolution of arguments until runtime, but to explicitly allow intrinsic functions as arguments.
description: | updated |
Changed in heat: | |
milestone: | none → mitaka-rc1 |
tags: | removed: liberty-backport-potential |
Fix proposed to branch: master /review. openstack. org/288794
Review: https:/