Merge "Default properties to the empty dict in ResourceGroup"

This commit is contained in:
Jenkins 2014-03-18 04:50:53 +00:00 committed by Gerrit Code Review
commit 63b4fdc13c
2 changed files with 10 additions and 0 deletions

View File

@ -145,6 +145,8 @@ class ResourceGroup(stack_resource.StackResource):
def _assemble_nested(self, count, include_all=False):
child_template = copy.deepcopy(template_template)
resource_def = self.properties[self.RESOURCE_DEF]
if resource_def[self.RESOURCE_DEF_PROPERTIES] is None:
resource_def[self.RESOURCE_DEF_PROPERTIES] = {}
if not include_all:
resource_def_props = resource_def[self.RESOURCE_DEF_PROPERTIES]
clean = dict((k, v) for k, v in resource_def_props.items() if v)

View File

@ -134,6 +134,14 @@ class ResourceGroupTest(common.HeatTestCase):
expect['resources']["0"]['properties'] = {"Foo": None}
self.assertEqual(expect, resg._assemble_nested(1, include_all=True))
def test_assemble_no_properties(self):
templ = copy.deepcopy(template)
res_def = templ["resources"]["group1"]["properties"]['resource_def']
del res_def['properties']
stack = utils.parse_stack(templ)
resg = stack.resources['group1']
self.assertIsNone(resg.validate())
def test_invalid_res_type(self):
"""Test that error raised for unknown resource type."""
tmp = copy.deepcopy(template)