Add Action Notification

This patch set adds the following action notifications:

- action.create
- action.update
- action.delete
- action.execution.start
- action.execution.end
- action.execution.error

Partially Implements: blueprint action-versioned-notifications-api

Change-Id: If0bc25bfb7cb1bff3bfa2c5d5fb9ad48b0794168
This commit is contained in:
Alexander Chadin
2017-02-01 14:21:18 +03:00
committed by alexchadin
parent 62cb8a8d29
commit 25789c9c5a
22 changed files with 1188 additions and 120 deletions

View File

@@ -17,6 +17,7 @@
from watcher.common import exception
from watcher.common import utils
from watcher.db import api as db_api
from watcher import notifications
from watcher import objects
from watcher.objects import base
from watcher.objects import fields as wfields
@@ -134,6 +135,8 @@ class Action(base.WatcherPersistentObject, base.WatcherObject,
# notifications containing information about the related relationships
self._from_db_object(self, db_action, eager=True)
notifications.action.send_create(self.obj_context, self)
def destroy(self):
"""Delete the Action from the DB"""
self.dbapi.destroy_action(self.uuid)
@@ -150,6 +153,7 @@ class Action(base.WatcherPersistentObject, base.WatcherObject,
db_obj = self.dbapi.update_action(self.uuid, updates)
obj = self._from_db_object(self, db_obj, eager=False)
self.obj_refresh(obj)
notifications.action.send_update(self.obj_context, self)
self.obj_reset_changes()
@base.remotable
@@ -173,3 +177,5 @@ class Action(base.WatcherPersistentObject, base.WatcherObject,
obj = self._from_db_object(
self.__class__(self._context), db_obj, eager=False)
self.obj_refresh(obj)
notifications.action.send_delete(self.obj_context, self)