]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
add watch_rule_get_all_by_stack dbapi call
authorSteven Hardy <shardy@redhat.com>
Mon, 19 Nov 2012 16:26:12 +0000 (16:26 +0000)
committerSteven Hardy <shardy@redhat.com>
Mon, 19 Nov 2012 22:26:20 +0000 (22:26 +0000)
Add option to retrieve all watch rules for a given stack, which
will be required to move to periodic watch threads per-stack

Ref bug 1078779

Change-Id: I350e2ee72c7eec0b91bf85ac52bb04e3cd00b4db
Signed-off-by: Steven Hardy <shardy@redhat.com>
heat/db/api.py
heat/db/sqlalchemy/api.py

index 27a9db37770b275ebaaab27e7f06da062c6ef212..14ca76c29d6e9397cf5cb3556a14fbc910030408 100644 (file)
@@ -154,6 +154,10 @@ def watch_rule_get_all(context):
     return IMPL.watch_rule_get_all(context)
 
 
+def watch_rule_get_all_by_stack(context, stack_id):
+    return IMPL.watch_rule_get_all_by_stack(context, stack_id)
+
+
 def watch_rule_create(context, values):
     return IMPL.watch_rule_create(context, values)
 
index cfcec42b07e2e4c3cee266644c317fb948c80820..57680b22a2bc1cccf84e69c10a96d18fcedcd4f6 100644 (file)
@@ -271,6 +271,12 @@ def watch_rule_get_all(context):
     return results
 
 
+def watch_rule_get_all_by_stack(context, stack_id):
+    results = model_query(context, models.WatchRule).\
+                          filter_by(stack_id=stack_id).all()
+    return results
+
+
 def watch_rule_create(context, values):
     obj_ref = models.WatchRule()
     obj_ref.update(values)