]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Use Template to instantiate TemplateResource
authorZane Bitter <zbitter@redhat.com>
Wed, 21 Aug 2013 14:52:13 +0000 (16:52 +0200)
committerZane Bitter <zbitter@redhat.com>
Wed, 21 Aug 2013 14:53:27 +0000 (16:53 +0200)
Use the Template class, rather than the raw template data, to obtain the
information required to create the schema of a TemplateResource facade.
This will allow this feature to work with multiple template formats (e.g.
HOT vs. CloudFormation).

Change-Id: Ifde739b081e95ed9f14567f35a0a1680c5e9b631

heat/engine/resources/template_resource.py

index 240c2c21250b90730ba8006a2212f43948715670..84707015cc3435fa621068ca1b3bca48ac6a4564 100644 (file)
@@ -21,6 +21,7 @@ from heat.engine import attributes
 from heat.engine import environment
 from heat.engine import properties
 from heat.engine import stack_resource
+from heat.engine import template
 
 from heat.openstack.common import log as logging
 
@@ -51,10 +52,11 @@ class TemplateResource(stack_resource.StackResource):
         # if we're not overriding via the environment, mirror the template as
         # a new resource
         if cri is None or cri.get_class() == self.__class__:
+            tmpl = template.Template(self.parsed_nested)
             self.properties_schema = (properties.Properties
-                .schema_from_params(self.parsed_nested.get('Parameters')))
+                .schema_from_params(tmpl.param_schemata()))
             self.attributes_schema = (attributes.Attributes
-                .schema_from_outputs(self.parsed_nested.get('Outputs')))
+                .schema_from_outputs(tmpl[template.OUTPUTS]))
         # otherwise we are overriding a resource type via the environment
         # and should mimic that type
         else: