Implemented audit.update notification

In this changeset, I implemented the sending of update notifications
whenever an audit is modified.

Change-Id: I5ccc2516ce896ae7d4ef542b133e8f052eaed602
Partially-Implements: blueprint audit-versioned-notifications-api
This commit is contained in:
Vincent Françoise
2016-10-17 17:48:39 +02:00
parent 54c45a2738
commit 9405eb0806
25 changed files with 722 additions and 85 deletions

View File

@@ -544,14 +544,11 @@ class AuditsController(rest.RestController):
raise exception.OperationNotPermitted
context = pecan.request.context
audit_to_update = api_utils.get_resource('Audit',
audit_uuid)
audit_to_update = api_utils.get_resource(
'Audit', audit_uuid, eager=True)
policy.enforce(context, 'audit:update', audit_to_update,
action='audit:update')
audit_to_update = objects.Audit.get_by_uuid(pecan.request.context,
audit_uuid)
try:
audit_dict = audit_to_update.as_dict()
audit = Audit(**api_utils.apply_jsonpatch(audit_dict, patch))
@@ -580,7 +577,8 @@ class AuditsController(rest.RestController):
:param audit_uuid: UUID of a audit.
"""
context = pecan.request.context
audit_to_delete = api_utils.get_resource('Audit', audit_uuid)
audit_to_delete = api_utils.get_resource(
'Audit', audit_uuid, eager=True)
policy.enforce(context, 'audit:update', audit_to_delete,
action='audit:update')