Remove deprecated notification event_type

For role assignment notifications there were two notifications
being emitted. We deprecated the original notification event_type
in Kilo and can now remove it in Mitaka. Also update a reference
of the old event_type in the notification docs.

implements bp removed-as-of-mitaka

Change-Id: I42e68d2b95014fb7500a709de6ecbd8e5f93bac4
This commit is contained in:
Steve Martinelli 2015-11-24 18:14:08 -05:00
parent 2feb7be843
commit c92e1b8726
2 changed files with 9 additions and 23 deletions

View File

@ -365,7 +365,7 @@ the unique identifier of the resource type.
.. code-block:: javascript
{
"event_type": "identity.created.role_assignment",
"event_type": "identity.role_assignment.created",
"message_id": "a5901371-d5fd-b3bb-448f-a14dead6f4cb",
"payload": {
"typeURI": "http://schemas.dmtf.org/cloud/audit/1.0/event",

View File

@ -22,7 +22,6 @@ import socket
from oslo_config import cfg
from oslo_log import log
from oslo_log import versionutils
import oslo_messaging
import pycadf
from pycadf import cadftaxonomy as taxonomy
@ -573,8 +572,6 @@ class CadfRoleAssignmentNotificationWrapper(object):
def __init__(self, operation):
self.action = '%s.%s' % (operation, self.ROLE_ASSIGNMENT)
self.deprecated_event_type = '%s.%s.%s' % (SERVICE, operation,
self.ROLE_ASSIGNMENT)
self.event_type = '%s.%s.%s' % (SERVICE, self.ROLE_ASSIGNMENT,
operation)
@ -632,30 +629,19 @@ class CadfRoleAssignmentNotificationWrapper(object):
audit_kwargs['inherited_to_projects'] = inherited
audit_kwargs['role'] = role_id
# For backward compatibility, send both old and new event_type.
# Deprecate old format and remove it in the next release.
event_types = [self.deprecated_event_type, self.event_type]
versionutils.deprecated(
as_of=versionutils.deprecated.KILO,
remove_in=+1,
what=('sending duplicate %s notification event type' %
self.deprecated_event_type),
in_favor_of='%s notification event type' % self.event_type)
try:
result = f(wrapped_self, role_id, *args, **kwargs)
except Exception:
for event_type in event_types:
_send_audit_notification(self.action, initiator,
taxonomy.OUTCOME_FAILURE,
target, event_type,
**audit_kwargs)
_send_audit_notification(self.action, initiator,
taxonomy.OUTCOME_FAILURE,
target, self.event_type,
**audit_kwargs)
raise
else:
for event_type in event_types:
_send_audit_notification(self.action, initiator,
taxonomy.OUTCOME_SUCCESS,
target, event_type,
**audit_kwargs)
_send_audit_notification(self.action, initiator,
taxonomy.OUTCOME_SUCCESS,
target, self.event_type,
**audit_kwargs)
return result
return wrapper