Merge "ResourceGroup don't special-case zero count"
This commit is contained in:
commit
4f095c5688
@ -237,11 +237,8 @@ class ResourceGroup(stack_resource.StackResource):
|
|||||||
|
|
||||||
def handle_create(self):
|
def handle_create(self):
|
||||||
names = self._resource_names()
|
names = self._resource_names()
|
||||||
if names:
|
return self.create_with_template(self._assemble_nested(names),
|
||||||
return self.create_with_template(
|
{}, self.stack.timeout_mins)
|
||||||
self._assemble_nested(names),
|
|
||||||
{},
|
|
||||||
self.stack.timeout_mins)
|
|
||||||
|
|
||||||
def handle_update(self, json_snippet, tmpl_diff, prop_diff):
|
def handle_update(self, json_snippet, tmpl_diff, prop_diff):
|
||||||
if prop_diff:
|
if prop_diff:
|
||||||
|
@ -252,6 +252,18 @@ class ResourceGroupTest(common.HeatTestCase):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
expect, resg._assemble_nested(['0'], include_all=True))
|
expect, resg._assemble_nested(['0'], include_all=True))
|
||||||
|
|
||||||
|
def test_assemble_nested_zero(self):
|
||||||
|
templ = copy.deepcopy(template)
|
||||||
|
templ['resources']['group1']['properties']['count'] = 0
|
||||||
|
stack = utils.parse_stack(templ)
|
||||||
|
snip = stack.t.resource_definitions(stack)['group1']
|
||||||
|
resg = resource_group.ResourceGroup('test', snip, stack)
|
||||||
|
expect = {
|
||||||
|
"heat_template_version": "2013-05-23",
|
||||||
|
"resources": {}
|
||||||
|
}
|
||||||
|
self.assertEqual(expect, resg._assemble_nested([]))
|
||||||
|
|
||||||
def test_index_var(self):
|
def test_index_var(self):
|
||||||
stack = utils.parse_stack(template_repl)
|
stack = utils.parse_stack(template_repl)
|
||||||
snip = stack.t.resource_definitions(stack)['group1']
|
snip = stack.t.resource_definitions(stack)['group1']
|
||||||
@ -662,10 +674,7 @@ class ResourceGroupTest(common.HeatTestCase):
|
|||||||
resg = stack['group1']
|
resg = stack['group1']
|
||||||
scheduler.TaskRunner(resg.create)()
|
scheduler.TaskRunner(resg.create)()
|
||||||
self.stack = resg.nested()
|
self.stack = resg.nested()
|
||||||
if expect_count > 0:
|
self.assertEqual(expect_count, len(resg.nested()))
|
||||||
self.assertEqual(expect_count, len(resg.nested()))
|
|
||||||
else:
|
|
||||||
self.assertIsNone(resg.nested())
|
|
||||||
self.assertEqual((resg.CREATE, resg.COMPLETE), resg.state)
|
self.assertEqual((resg.CREATE, resg.COMPLETE), resg.state)
|
||||||
return resg
|
return resg
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user