yaql function breaks due to get_attr returning null
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Heat |
Triaged
|
Medium
|
Unassigned |
Bug Description
I know this is part of a more general problem, but I'm trying to figure out the cleanest workaround for this situation:
(undercloud) [stack@undercloud ~]$ cat test.yaml
heat_template_
resources:
ServiceChain:
type: OS::Heat:
properties:
resources:
- Rsrc::One
- Rsrc::Two
- Rsrc::Disabled
- Rsrc::Three
concurrent: true
# This fails like
# ERROR: Property error: : resources.
# Because the get_attr function returns None during validation
PuppetStepConfig:
type: OS::Heat::Value
properties:
type: string
value:
yaql:
# select 'step_config' only from services that do not have a docker_config
data:
outputs:
role_data:
value: {get_attr: [ServiceChain, role_data]}
# The same expression here works fine
debug:
value:
yaql:
expression:
# select 'step_config' only from services that do not have a docker_config
data:
(undercloud) [stack@undercloud ~]$ cat env.yaml
resource_registry:
Rsrc::One: one.yaml
Rsrc::Two: two.yaml
Rsrc::Disabled: OS::Heat::None
Rsrc::Three: three.yaml
(undercloud) [stack@undercloud ~]$ cat one.yaml
heat_template_
outputs:
role_data:
value:
service_name: service_one
step_config: dontuseme
docker_
(undercloud) [stack@undercloud ~]$ cat two.yaml
heat_template_
outputs:
role_data:
value:
service_name: service_two
step_config: usethispuppet
(undercloud) [stack@undercloud ~]$ cat three.yaml
heat_template_
outputs:
role_data:
value:
service_name: service_three
step_config: usethispuppet2
The issue is the nested get_attr in the data for yaql evaluates to None, and it's not only happening when the function.validate is called, e.g I added this debug:
2017-07-19 08:11:05.079 23710 INFO heat.engine.
2017-07-19 08:11:05.080 23710 WARNING heat.engine.
2017-07-19 08:11:05.080 23710 WARNING heat.engine.
2017-07-19 08:11:05.080 23710 WARNING heat.engine.
2017-07-19 08:11:05.080 23710 WARNING heat.engine.
2017-07-19 08:11:05.198 23710 WARNING heat.engine.
We can see the value is validated for the resource, which causes the function evaluation, which means get_attr returns None which breaks the otherwise valid yaql query (see the output, it works fine if you comment the value resource, because we don't strictly validate outputs due to https:/
Changed in heat: | |
status: | New → Triaged |
importance: | Undecided → Medium |
Changed in heat: | |
milestone: | none → no-priority-tag-bugs |
Running into this as well. Using yaql to get the length of a list and I get the same receiver for None error. What is interesting is when I instead used yaql to check if the data is a list, it returns true.
project_count:
expression: isList( $.data. project_ list)
project_ list: { get_attr: [project_list, value] }
type: OS::Heat::Value
properties:
value:
yaql:
data: