]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Reset the the watch_rule.last_evaluated on start up
authorAngus Salkeld <asalkeld@redhat.com>
Fri, 19 Jul 2013 06:06:20 +0000 (16:06 +1000)
committerAngus Salkeld <asalkeld@redhat.com>
Fri, 19 Jul 2013 06:06:20 +0000 (16:06 +1000)
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

index b4d9053f85ebe91af6187b1f46ed1ed314893621..66797fceec3ed83f76f2faf7b1ea660f7dbcd7e3 100644 (file)
@@ -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)