]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Allow Parameters to set defaults for TemplateResource
authorZane Bitter <zbitter@redhat.com>
Mon, 19 Aug 2013 18:51:45 +0000 (20:51 +0200)
committerZane Bitter <zbitter@redhat.com>
Mon, 19 Aug 2013 18:51:45 +0000 (20:51 +0200)
Although it is theoretically possible to infer default values for the
Properties of a TemplateResource from the Parameters of the provider
template, this presents a number of conversion issues that are presently
unhandled.

Instead, pass parameter values only for properties that are supplied.  For
the others, allow the parameter defaults in the template to be used.

Change-Id: I2ba49ffeee06c3a272694c18b3875f843ade1e6c

heat/engine/resources/template_resource.py

index fd3ce62b342a27640f444f4b47bbbf2b86b60e63..b629f5768077d9327193caea23acc366074ec12c 100644 (file)
@@ -67,15 +67,18 @@ class TemplateResource(stack_resource.StackResource):
         for n, v in iter(self.properties.props.items()):
             if not v.implemented():
                 continue
-            elif v.type() == properties.LIST:
+
+            val = self.properties[n]
+
+            if val is not None:
                 # take a list and create a CommaDelimitedList
-                val = self.properties[n]
-                if val:
-                    params[n] = ','.join(val)
-            else:
+                if v.type() == properties.LIST:
+                    val = ','.join(val)
+
                 # for MAP, the JSON param takes either a collection or string,
                 # so just pass it on and let the param validate as appropriate
-                params[n] = self.properties[n]
+
+                params[n] = val
 
         return params