Implemented audit.create notification

In this changeset, I implemented the audit.create notification.

Change-Id: Ia092ca3a3dc951e3313a07f15a98aec5818e9ab0
Partially-Implements: blueprint audit-versioned-notifications-api
This commit is contained in:
Vincent Françoise
2016-10-20 09:37:49 +02:00
parent 9405eb0806
commit 0c0a9c84d6
16 changed files with 332 additions and 88 deletions

View File

@@ -236,6 +236,11 @@ class Audit(base.WatcherPersistentObject, base.WatcherObject,
# notifications containing information about the related relationships
self._from_db_object(self, db_audit, eager=True)
def _notify():
notifications.audit.send_create(self._context, self)
_notify()
@base.remotable
def destroy(self):
"""Delete the Audit from the DB."""

View File

@@ -155,7 +155,7 @@ class WatcherPersistentObject(object):
if obj[rel_id]
)
for obj_field, related_obj_cls, rel_id in loadable_fields:
if db_object.get(obj_field) and obj[rel_id]:
if getattr(db_object, obj_field, None) and obj[rel_id]:
# The object field data was eagerly loaded alongside
# the main object data
obj[obj_field] = related_obj_cls._from_db_object(