Always update remote_stack

Always update remote_stack even though properties didn't change,
and let the let the individual resources in it decide if they
need updating

Closes-Bug: #1428979
Change-Id: Id0898683b86e3a72e539f2432f521c7ee70afe26
This commit is contained in:
Ethan Lynn 2015-03-06 23:54:43 +08:00
parent f2a1edd3b9
commit 4cbd1431ee
2 changed files with 21 additions and 1 deletions

View File

@ -192,7 +192,9 @@ class RemoteStack(resource.Resource):
return True
def handle_update(self, json_snippet, tmpl_diff, prop_diff):
if self.resource_id and prop_diff:
# Always issue an update to the remote stack and let the individual
# resources in it decide if they need updating.
if self.resource_id:
snippet = json_snippet.get('Properties', {})
self.properties = properties.Properties(self.properties_schema,
snippet,

View File

@ -575,6 +575,24 @@ class RemoteStackTest(tests_common.HeatTestCase):
self.assertEqual((rsrc.UPDATE, rsrc.FAILED), rsrc.state)
self.assertEqual(2, len(self.heat.stacks.get.call_args_list))
def test_update_no_change(self):
stacks = [get_stack(stack_status='UPDATE_IN_PROGRESS'),
get_stack(stack_status='UPDATE_COMPLETE')]
def side_effect(*args, **kwargs):
return stacks.pop(0)
rsrc = self.create_remote_stack()
props = copy.deepcopy(rsrc.parsed_template()['Properties'])
update_snippet = rsrc_defn.ResourceDefinition(rsrc.name,
rsrc.type(),
props)
self.heat.stacks.get = mock.MagicMock(side_effect=side_effect)
scheduler.TaskRunner(rsrc.update, update_snippet)()
self.assertEqual((rsrc.UPDATE, rsrc.COMPLETE), rsrc.state)
def test_stack_status_error(self):
returns = [get_stack(stack_status='DELETE_IN_PROGRESS'),
get_stack(stack_status='UPDATE_COMPLETE')]