diff options
author | Rakesh H S <rh-s@hpe.com> | 2015-11-16 20:23:26 +0530 |
---|---|---|
committer | Rakesh H S <rh-s@hpe.com> | 2015-12-03 18:35:57 +0530 |
commit | 411360f7d130a7639bf01954eef71c8bf7d097fa (patch) | |
tree | a93e9f7f1468dc5d7a5801be3164c9ba0835c3ec /heat | |
parent | fde2da4f019196e9148e4115b89cba76c3f7b72c (diff) | |
download | heat-411360f7d130a7639bf01954eef71c8bf7d097fa.tar.gz |
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
Diffstat (limited to 'heat')
-rw-r--r-- | heat/engine/service.py | 2 | ||||
-rw-r--r-- | heat/tests/engine/service/test_stack_events.py | 3 | ||||
-rw-r--r-- | heat/tests/test_stack_update.py | 5 |
3 files changed, 7 insertions, 3 deletions
diff --git a/heat/engine/service.py b/heat/engine/service.py index 707ed183c..f3574c61d 100644 --- a/heat/engine/service.py +++ b/heat/engine/service.py @@ -178,7 +178,7 @@ class ThreadGroupManager(object): releasing the lock to avoid race condtitions. """ 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) else: lock.release() diff --git a/heat/tests/engine/service/test_stack_events.py b/heat/tests/engine/service/test_stack_events.py index dde60f589..bfb082dda 100644 --- a/heat/tests/engine/service/test_stack_events.py +++ b/heat/tests/engine/service/test_stack_events.py @@ -109,7 +109,6 @@ class StackEventTest(common.HeatTestCase): result = self.eng.update_stack(self.ctx, self.stack.identifier(), new_tmpl, None, None, {}) - self.stack._persist_state() # The self.stack reference needs to be updated. Since the underlying # stack is updated in update_stack, the original reference is now @@ -121,7 +120,7 @@ class StackEventTest(common.HeatTestCase): self.assertTrue(result['stack_id']) events = self.eng.list_events(self.ctx, self.stack.identifier()) - self.assertEqual(11, len(events)) + self.assertEqual(10, len(events)) for ev in events: self.assertIn('event_identity', ev) diff --git a/heat/tests/test_stack_update.py b/heat/tests/test_stack_update.py index f137107d8..58f4416fc 100644 --- a/heat/tests/test_stack_update.py +++ b/heat/tests/test_stack_update.py @@ -924,6 +924,7 @@ class StackUpdateTest(common.HeatTestCase): self.stack.create() self.assertEqual((stack.Stack.CREATE, stack.Stack.COMPLETE), self.stack.state) + self.stack._persist_state() tmpl2 = {'HeatTemplateFormatVersion': '2012-12-12', 'Resources': {'AResource': {'Type': 'ResourceWithPropsType', @@ -944,6 +945,10 @@ class StackUpdateTest(common.HeatTestCase): self.stack.update(updated_stack) self.assertEqual((stack.Stack.ROLLBACK, stack.Stack.COMPLETE), 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(5, mock_db_update.call_count) self.assertEqual('UPDATE', |