Add watch_rule_update DB API call, needed for WatchRule
refactor/rework
Ref #217
Signed-off-by: Steven Hardy <shardy@redhat.com>
Change-Id: Ie8321d390ab96e987bfa4c97c26f1e0305f6bd48
return IMPL.watch_rule_create(context, values)
+def watch_rule_update(context, watch_id, values):
+ return IMPL.watch_rule_update(context, watch_id, values)
+
+
def watch_rule_delete(context, watch_rule_name):
return IMPL.watch_rule_delete(context, watch_rule_name)
return obj_ref
+def watch_rule_update(context, watch_id, values):
+ wr = watch_rule_get(context, watch_id)
+
+ if not wr:
+ raise NotFound('Attempt to update a watch with id: %s %s' %
+ (watch_id, 'that does not exist'))
+
+ wr.update(values)
+ wr.save()
+
+
def watch_rule_delete(context, watch_name):
wr = model_query(context, models.WatchRule).\
filter_by(name=watch_name).first()