From 07d1a9c90b2c96f231f9bd8fe6d59bfec8c1d22d Mon Sep 17 00:00:00 2001 From: Angus Salkeld Date: Fri, 19 Jul 2013 16:06:20 +1000 Subject: [PATCH] Reset the the watch_rule.last_evaluated on start up This is so we don't fire off alarms when the engine has not been running. bug 1202552 Change-Id: Ief258fd601b48e2495ac69091a942f23a019e92c --- heat/engine/service.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/heat/engine/service.py b/heat/engine/service.py index b4d9053f..66797fce 100644 --- a/heat/engine/service.py +++ b/heat/engine/service.py @@ -19,6 +19,7 @@ import json from oslo.config import cfg import webob +from heat.openstack.common import timeutils from heat.common import context from heat.db import api as db_api from heat.engine import api @@ -98,6 +99,13 @@ class EngineService(service.Service): def _start_watch_task(self, stack_id, cnxt): wrs = db_api.watch_rule_get_all_by_stack(cnxt, stack_id) + + # reset the last_evaluated so we don't fire off alarms when + # the engine has not been running. + now = timeutils.utcnow() + for wr in wrs: + db_api.watch_rule_update(cnxt, wr.id, {'last_evaluated': now}) + if len(wrs) > 0: self._timer_in_thread(stack_id, self._periodic_watcher_task, sid=stack_id) -- 2.45.2