Default properties to the empty dict in ResourceGroup
Sets the properties of the grouped resource to {} when it's None to make sure the resource is built properly. Change-Id: I2938c741063159ef81a7996d203adaf466cf19c4 Closes-Bug: #1291421
This commit is contained in:
parent
22fd357a5e
commit
73c29d3edc
|
@ -146,6 +146,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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue