Merge "Make sure that nested stacks have their watch rules checked"

This commit is contained in:
Jenkins 2013-10-08 04:50:35 +00:00 committed by Gerrit Code Review
commit f30ca4419c
1 changed files with 14 additions and 6 deletions

View File

@ -681,12 +681,7 @@ class EngineService(service.Service):
return resource.metadata
def _periodic_watcher_task(self, sid):
"""
Periodic task, created for each stack, triggers watch-rule
evaluation for all rules defined for the stack
sid = stack ID
"""
def _check_stack_watches(self, sid):
# Retrieve the stored credentials & create context
# Require admin=True to the stack_get to defeat tenant
# scoping otherwise we fail to retrieve the stack
@ -699,6 +694,11 @@ class EngineService(service.Service):
return
stack_context = self._load_user_creds(stack.user_creds_id)
# recurse into any nested stacks.
children = db_api.stack_get_all_by_owner_id(admin_context, sid)
for child in children:
self._check_stack_watches(child.id)
# Get all watchrules for this stack and evaluate them
try:
wrs = db_api.watch_rule_get_all_by_stack(stack_context, sid)
@ -722,6 +722,14 @@ class EngineService(service.Service):
self._start_in_thread(sid, run_alarm_action, actions,
rule.get_details())
def _periodic_watcher_task(self, sid):
"""
Periodic task, created for each stack, triggers watch-rule
evaluation for all rules defined for the stack
sid = stack ID
"""
self._check_stack_watches(sid)
@request_context
def create_watch_data(self, cnxt, watch_name, stats_data):
'''