Nested Provider resources not found

Bug #1297396 reported by Steve Lipinski
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
High
Angus Salkeld
Icehouse
Fix Released
High
Steve Baker

Bug Description

When using provider resources/templates, resources defined in the resource_registry of an environment file passed to the heat client does not seem to support nested resources.

If I have the following resource_registry in an environment file passed to heat stack-create via -e:
resource_registry:
  "My::Parent::Res": "file:///root/My-Parent-Res.hot.yaml"
  "My::Child::Res": "file:///root/My-Child-Res.hot.yaml"

If in my main template, I have a resource:
resources:
  parent:
    type: My::Parent::Res
..

And, in My-Parent-Res.hot.yaml, I have
resources:
  child:
    type: My::Child::Res

This causes a stack validation error upon stack creation. In the heat-engine.log:
StackValidationFailed: Unknown resource Type : My::Child::Res

Yet, if I move the resource_registry to the global environment, e.g., /etc/heat/environment.d/myenv.yaml.
Then it works.

I would assume a resource_registry defined in a passed environment file should behave the same as one defined in the environment.d. Or at least as far as nesting would be concerned...

Revision history for this message
lvdongbing (dbcocle) wrote :

It seems that the path lack one '/', it should be "file:///root/My-Parent-Res.hot.yaml"

Revision history for this message
Steve Lipinski (steve-lipinski) wrote :

Yes - that was a typo in copy/paste. The three forward slashes were used. I updated the original post to reflect that. Same issue exists if 3 slashes are used.

description: updated
Revision history for this message
Steve Baker (steve-stevebaker) wrote :

Can you confirm with "heat --debug stack-create" that the contents of both files is in the "files" section of the create json?

If so I'll remove python-heatclient from this bug.

Changed in python-heatclient:
status: New → Incomplete
Changed in heat:
status: New → Triaged
importance: Undecided → High
milestone: none → juno-1
milestone: juno-1 → icehouse-rc2
Revision history for this message
Steve Lipinski (steve-lipinski) wrote :

Yes I can confirm that:

'{"files": {"file:///root/bug/My-Child-Res.hot.yaml": "heat_template_version: 2013-05-23\n\nresources:\n test:\n type: OS::Heat::RandomString\n \n", "file:///root/bug/My-Parent-Res.hot.yaml": "heat_template_version: 2013-05-23\n\nresources:\n child:\n type: My::Child::Res\n"}, "disable_rollback": true, "parameters": {}, "stack_name": "test", "environment": {"resource_registry": {"My::Parent::Res": "file:///root/bug/My-Parent-Res.hot.yaml", "My::Child::Res": "file:///root/bug/My-Child-Res.hot.yaml"}}, "template": {"heat_template_version": "2013-05-23", "resources": {"test": {"type": "My::Parent::Res"}}}, "timeout_mins": 60}'

Revision history for this message
Steve Baker (steve-stevebaker) wrote :

Thanks, lets focus on heat for the fix then.

no longer affects: python-heatclient
Revision history for this message
Steve Baker (steve-stevebaker) wrote :

Actually this change is minutes away from landing https://review.openstack.org/#/c/83442/ , which make this bug a duplicate of bug #1298450

Could you please test with that change and see if it fixes your issue?

Revision history for this message
Steve Lipinski (steve-lipinski) wrote :

No - this https://review.openstack.org/#/c/83442/ does not seem to fix my issue.

Revision history for this message
Angus Salkeld (asalkeld) wrote :

Steve you had a typo in your env.

 resource_registry:
- "My::Secret": "OS::Heat:RandomString"
+ "My::Secret": "OS::Heat::RandomString"

heat stack-create -f bug-1297396.yaml -e bug-1297396-env.yaml boya
+--------------------------------------+------------+--------------------+----------------------+
| id | stack_name | stack_status | creation_time |
+--------------------------------------+------------+--------------------+----------------------+
| 4be1d499-906f-4873-ac6b-5358312b700e | boya | CREATE_IN_PROGRESS | 2014-04-09T04:23:35Z |
+--------------------------------------+------------+--------------------+----------------------+
angus@troll:~/work$ heat list
+--------------------------------------+------------+-----------------+----------------------+
| id | stack_name | stack_status | creation_time |
+--------------------------------------+------------+-----------------+----------------------+
| 4be1d499-906f-4873-ac6b-5358312b700e | boya | CREATE_COMPLETE | 2014-04-09T04:23:35Z |
+--------------------------------------+------------+-----------------+----------------------+

Angus Salkeld (asalkeld)
Changed in heat:
assignee: nobody → Angus Salkeld (asalkeld)
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/86228

Changed in heat:
status: Triaged → In Progress
Revision history for this message
Steve Baker (steve-stevebaker) wrote :
Revision history for this message
Steve Baker (steve-stevebaker) wrote :
Revision history for this message
Steve Baker (steve-stevebaker) wrote :
Revision history for this message
Steve Baker (steve-stevebaker) wrote :

Replicate this issue by downloading the above 3 files and running

heat stack-create -f bug-1297396-base.yaml -e bug-1297396-env.yaml b

The patch in #11 fixes the issue for me with these files.

Changed in heat:
milestone: icehouse-rc2 → juno-1
Revision history for this message
loscouw (giorgio-vitale11) wrote :

I tryed the patch in #11 and it doesn't work.

Revision history for this message
loscouw (giorgio-vitale11) wrote :

2014-05-20 16:33:59.742 24989 TRACE heat.engine.parser res = super(NeutronResource, self).validate()
2014-05-20 16:33:59.742 24989 TRACE heat.engine.parser File "/usr/lib/python2.6/site-packages/heat/engine/resource.py", line 670, in validate
2014-05-20 16:33:59.742 24989 TRACE heat.engine.parser function.validate(self.t)
2014-05-20 16:33:59.742 24989 TRACE heat.engine.parser AttributeError: 'module' object has no attribute 'validate'

Revision history for this message
Pavlo Shchelokovskyy (pshchelo) wrote :

that's strange, as heat.function definitely has validate method in master. How old is your heat installation?

Revision history for this message
Pavlo Shchelokovskyy (pshchelo) wrote :

heat.engine.function that is

Revision history for this message
loscouw (giorgio-vitale11) wrote :

I'm using ice-house release.

Revision history for this message
loscouw (giorgio-vitale11) wrote :

Is a backport to Icehouse planed for this fix?

Revision history for this message
Steve Baker (steve-stevebaker) wrote :

This looks like a contender for backporting

tags: added: icehouse-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/86228
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=37bb332f351d03506ce5703a397c15357d2265d9
Submitter: Jenkins
Branch: master

commit 37bb332f351d03506ce5703a397c15357d2265d9
Author: Angus Salkeld <email address hidden>
Date: Thu May 29 10:03:40 2014 +1000

    Pass the parent's registry into child stacks

    We make sure that there is no infinite recursion by not repeating
    a TemplateResource within a resources inheritance.

    Change-Id: I1ffa66886923b15b52a8075089dd4042f0a55862
    Fixes-bug: #1297396

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

Fix proposed to branch: stable/icehouse
Review: https://review.openstack.org/102407

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

Reviewed: https://review.openstack.org/102407
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=2db68e5e923276b4882ad400b16e99c3cc065150
Submitter: Jenkins
Branch: stable/icehouse

commit 2db68e5e923276b4882ad400b16e99c3cc065150
Author: Angus Salkeld <email address hidden>
Date: Thu May 29 10:03:40 2014 +1000

    Pass the parent's registry into child stacks

    We make sure that there is no infinite recursion by not repeating
    a TemplateResource within a resources inheritance.

    Change-Id: I1ffa66886923b15b52a8075089dd4042f0a55862
    Closes-Bug: #1297396

Thierry Carrez (ttx)
Changed in heat:
milestone: juno-1 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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