From: Steven Hardy Date: Mon, 19 Nov 2012 16:26:12 +0000 (+0000) Subject: add watch_rule_get_all_by_stack dbapi call X-Git-Tag: 2014.1~1193^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=1563f3039f3335d53891da055dcbb2b2334a234f;p=openstack-build%2Fheat-build.git add watch_rule_get_all_by_stack dbapi call 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 --- diff --git a/heat/db/api.py b/heat/db/api.py index 27a9db37..14ca76c2 100644 --- a/heat/db/api.py +++ b/heat/db/api.py @@ -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) diff --git a/heat/db/sqlalchemy/api.py b/heat/db/sqlalchemy/api.py index cfcec42b..57680b22 100644 --- a/heat/db/sqlalchemy/api.py +++ b/heat/db/sqlalchemy/api.py @@ -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)