Merge "Default properties to the empty dict in ResourceGroup"
This commit is contained in:
commit
63b4fdc13c
@ -145,6 +145,8 @@ class ResourceGroup(stack_resource.StackResource):
|
|||||||
def _assemble_nested(self, count, include_all=False):
|
def _assemble_nested(self, count, include_all=False):
|
||||||
child_template = copy.deepcopy(template_template)
|
child_template = copy.deepcopy(template_template)
|
||||||
resource_def = self.properties[self.RESOURCE_DEF]
|
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:
|
if not include_all:
|
||||||
resource_def_props = resource_def[self.RESOURCE_DEF_PROPERTIES]
|
resource_def_props = resource_def[self.RESOURCE_DEF_PROPERTIES]
|
||||||
clean = dict((k, v) for k, v in resource_def_props.items() if v)
|
clean = dict((k, v) for k, v in resource_def_props.items() if v)
|
||||||
|
@ -134,6 +134,14 @@ class ResourceGroupTest(common.HeatTestCase):
|
|||||||
expect['resources']["0"]['properties'] = {"Foo": None}
|
expect['resources']["0"]['properties'] = {"Foo": None}
|
||||||
self.assertEqual(expect, resg._assemble_nested(1, include_all=True))
|
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):
|
def test_invalid_res_type(self):
|
||||||
"""Test that error raised for unknown resource type."""
|
"""Test that error raised for unknown resource type."""
|
||||||
tmp = copy.deepcopy(template)
|
tmp = copy.deepcopy(template)
|
||||||
|
Loading…
Reference in New Issue
Block a user