ResourceGroup attributes don't work with index lookups
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Heat |
New
|
Low
|
Unassigned |
Bug Description
We seem to have an issue with order of evaluation the path-based index for outputs where a list is generated, e.g:
[stack@instack ~]$ cat rg.yaml
heat_template_
resources:
rg:
type: OS::Heat:
properties:
count: 3
resource_def:
type: OS::Heat::Value
properties:
value: foo
outputs:
test_out_list:
value: {get_attr: [rg, value]}
test_out_zero:
value: {get_attr: [rg, value, 0]}
[stack@instack ~]$ openstack stack output show rg1 test_out_list
+------
| Field | Value |
+------
| description | No description given |
| output_key | test_out_list |
| output_value | [ |
| | "foo", |
| | "foo", |
| | "foo" |
| | ] |
+------
[stack@instack ~]$ openstack stack output show rg1 test_out_zero
+------
| Field | Value |
+------
| description | No description given |
| output_key | test_out_zero |
| output_value | [ |
| | "f", |
| | "f", |
| | "f" |
| | ] |
+------
I expected test_out_zero to return "foo" e.g the first list item, but it's evaluating it for each item inside the group.
I seem to recall a similar bug about this in the past, but failed to locate it.
If this is expected behaviour we should at least document it, perhaps showing how to do the list lookup with yaql instead.
Changed in heat: | |
milestone: | ocata-1 → ocata-2 |
Changed in heat: | |
milestone: | ocata-2 → ocata-3 |
Yeah that behavior looks correct to me. It is indeed a bit confusing with regard to the regular get_attr behavior, but it behaves fairly differently on stack resources in general.
Fortunately you don't need yaql. You can either do:
{get_attr: [rg, 'resource.0', value]}
Or
rg_val:
type: OS::Heat::Value
properties:
value: {get_attr: [rg, value]}
{get_attr: [rg_val, value, 0]}