heat : db API add watch_rule_update DB API action
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
This commit is contained in:
parent
5df2d6f702
commit
db0a268f41
|
@ -155,6 +155,10 @@ def watch_rule_create(context, values):
|
|||
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)
|
||||
|
||||
|
|
|
@ -276,6 +276,17 @@ def watch_rule_create(context, values):
|
|||
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()
|
||||
|
|
Loading…
Reference in New Issue