From: Angus Salkeld Date: Fri, 19 Jul 2013 06:06:20 +0000 (+1000) Subject: Reset the the watch_rule.last_evaluated on start up X-Git-Tag: 2014.1~339^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=07d1a9c90b2c96f231f9bd8fe6d59bfec8c1d22d;p=openstack-build%2Fheat-build.git 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 --- 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)