Fix to send only one notification when update completes
Presently when an update is COMPLETE/FAILED, two events are reported. In update_task we are already sending notification when an update completes, however due to recent changes, notifications are also sent at the time of releasing stack lock. For update, we need not send notification when releasing lock. Change-Id: Idc81f87b143dc43fa5409798534646d8400559ff Closes-Bug: #1516090
This commit is contained in:
parent
fde2da4f01
commit
411360f7d1
@ -178,7 +178,7 @@ class ThreadGroupManager(object):
|
|||||||
releasing the lock to avoid race condtitions.
|
releasing the lock to avoid race condtitions.
|
||||||
"""
|
"""
|
||||||
if stack is not None and stack.action not in (
|
if stack is not None and stack.action not in (
|
||||||
stack.DELETE, stack.ROLLBACK):
|
stack.DELETE, stack.ROLLBACK, stack.UPDATE):
|
||||||
stack.persist_state_and_release_lock(lock.engine_id)
|
stack.persist_state_and_release_lock(lock.engine_id)
|
||||||
else:
|
else:
|
||||||
lock.release()
|
lock.release()
|
||||||
|
@ -109,7 +109,6 @@ class StackEventTest(common.HeatTestCase):
|
|||||||
|
|
||||||
result = self.eng.update_stack(self.ctx, self.stack.identifier(),
|
result = self.eng.update_stack(self.ctx, self.stack.identifier(),
|
||||||
new_tmpl, None, None, {})
|
new_tmpl, None, None, {})
|
||||||
self.stack._persist_state()
|
|
||||||
|
|
||||||
# The self.stack reference needs to be updated. Since the underlying
|
# The self.stack reference needs to be updated. Since the underlying
|
||||||
# stack is updated in update_stack, the original reference is now
|
# stack is updated in update_stack, the original reference is now
|
||||||
@ -121,7 +120,7 @@ class StackEventTest(common.HeatTestCase):
|
|||||||
self.assertTrue(result['stack_id'])
|
self.assertTrue(result['stack_id'])
|
||||||
events = self.eng.list_events(self.ctx, self.stack.identifier())
|
events = self.eng.list_events(self.ctx, self.stack.identifier())
|
||||||
|
|
||||||
self.assertEqual(11, len(events))
|
self.assertEqual(10, len(events))
|
||||||
|
|
||||||
for ev in events:
|
for ev in events:
|
||||||
self.assertIn('event_identity', ev)
|
self.assertIn('event_identity', ev)
|
||||||
|
@ -924,6 +924,7 @@ class StackUpdateTest(common.HeatTestCase):
|
|||||||
self.stack.create()
|
self.stack.create()
|
||||||
self.assertEqual((stack.Stack.CREATE, stack.Stack.COMPLETE),
|
self.assertEqual((stack.Stack.CREATE, stack.Stack.COMPLETE),
|
||||||
self.stack.state)
|
self.stack.state)
|
||||||
|
self.stack._persist_state()
|
||||||
|
|
||||||
tmpl2 = {'HeatTemplateFormatVersion': '2012-12-12',
|
tmpl2 = {'HeatTemplateFormatVersion': '2012-12-12',
|
||||||
'Resources': {'AResource': {'Type': 'ResourceWithPropsType',
|
'Resources': {'AResource': {'Type': 'ResourceWithPropsType',
|
||||||
@ -944,6 +945,10 @@ class StackUpdateTest(common.HeatTestCase):
|
|||||||
self.stack.update(updated_stack)
|
self.stack.update(updated_stack)
|
||||||
self.assertEqual((stack.Stack.ROLLBACK, stack.Stack.COMPLETE),
|
self.assertEqual((stack.Stack.ROLLBACK, stack.Stack.COMPLETE),
|
||||||
self.stack.state)
|
self.stack.state)
|
||||||
|
self.eng = service.EngineService('a-host', 'a-topic')
|
||||||
|
events = self.eng.list_events(self.ctx, self.stack.identifier())
|
||||||
|
self.assertEqual(10, len(events))
|
||||||
|
|
||||||
self.assertEqual('abc', self.stack['AResource'].properties['Foo'])
|
self.assertEqual('abc', self.stack['AResource'].properties['Foo'])
|
||||||
self.assertEqual(5, mock_db_update.call_count)
|
self.assertEqual(5, mock_db_update.call_count)
|
||||||
self.assertEqual('UPDATE',
|
self.assertEqual('UPDATE',
|
||||||
|
Loading…
Reference in New Issue
Block a user