heat intrinsic function get_attr used in heat resourcegroup does not fetch anything

asked 2020-03-25 11:30:56 -0500

slavonic gravatar image

updated 2020-04-30 11:59:13 -0500

zaneb gravatar image

INFO:

rocky release
Installed Packages
openstack-heat-api.noarch                                           1:11.0.2-1.el7                                        @centos-openstack-rocky
openstack-heat-api-cfn.noarch                                       1:11.0.2-1.el7                                        @centos-openstack-rocky
openstack-heat-engine.noarch                                        1:11.0.2-1.el7                                        @centos-openstack-rocky
heat --version
1.16.1

Let me first share the snippets of my templates: (full templates available here: https://github.com/slavonicsniper/hea...)

group_instance_create.yaml

my_indexed_group:
type: OS::Heat::ResourceGroup
.
.
.
properties:
      poolids:
        if: 
        - "listener_count_is_not_zero"
        - get_attr: [lb_group, poolID]
        - get_param: poolids

lb_create.yaml

outputs:
  poolID:
    description: LB pool id
    value: { get_resource: pool }

This works fine when I do stack create but fails when I do stack update.

openstack stack update test-lb -e /home/stack/heat/test/parameters/test-lb.yaml-t git/heat/resources/group_instance_create.yaml --dry-run --show-nested -f shell ERROR: Internal Error

error logs:

2020-03-25 16:06:59.417 2020-03-25 16:06:51.281 39936 ERROR heat.common.wsgi [req-a589e893-3c2f-41f4-a5ac-f3fcfdd07a36
- test - default default] Unexpected error occurred serving API: Property poolids not assigned 2020-03-25 16:06:59.418 ValueError: Property poolids not assigned 2020-03-25 16:06:59.420 2020-03-25 16:06:51.272 39876 ERROR oslo_messaging.rpc.server [req-31a3e12f-7695-4c21-be70-2bfa25715a93
- - - - -] Exception during message handling: ValueError: Property poolids not assigned 2020-03-25 16:06:59.421 2020-03-25 16:06:51.272 39876 ERROR oslo_messaging.rpc.server ValueError: Property poolids not assigned

it looks like intrinsic functions get_attr and get_resource inside a resource with type 'type: OS::Heat::ResourceGroup' cannot retrieve the attribute values or the attributes are empty.

I checked the attributes of the resource and output key poolID is empty after the creation:

openstack stack resource show test-lb lb_group --with-attr poolID -c attributes
+------------+----------------------------------------------------------------------------------------------------+ | Field      | Value                   |
+------------+----------------------------------------------------------------------------------------------------+ | attributes | {u'attributes': None, u'refs': None, u'poolID': None, u'refs_map': None, u'removed_rsrc_list': []} |
+------------+----------------------------------------------------------------------------------------------------+

But it could not be empty during the creation because it didn't fail and worked fine.

Could anyone help me to fix this or understand better the nested templates.

It works with stack update in an openstack env. on queens release.

Thanks

edit retag flag offensive close merge delete

Comments

Does this happen when you actually update the stack, or only when using --dry-run? Those use completely different code paths, so it's possible there is a bug in the preview.

zaneb gravatar imagezaneb ( 2020-04-30 12:06:14 -0500 )edit