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:
parent
2feb7be843
commit
c92e1b8726
|
@ -365,7 +365,7 @@ the unique identifier of the resource type.
|
||||||
.. code-block:: javascript
|
.. code-block:: javascript
|
||||||
|
|
||||||
{
|
{
|
||||||
"event_type": "identity.created.role_assignment",
|
"event_type": "identity.role_assignment.created",
|
||||||
"message_id": "a5901371-d5fd-b3bb-448f-a14dead6f4cb",
|
"message_id": "a5901371-d5fd-b3bb-448f-a14dead6f4cb",
|
||||||
"payload": {
|
"payload": {
|
||||||
"typeURI": "http://schemas.dmtf.org/cloud/audit/1.0/event",
|
"typeURI": "http://schemas.dmtf.org/cloud/audit/1.0/event",
|
||||||
|
|
|
@ -22,7 +22,6 @@ import socket
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from oslo_log import versionutils
|
|
||||||
import oslo_messaging
|
import oslo_messaging
|
||||||
import pycadf
|
import pycadf
|
||||||
from pycadf import cadftaxonomy as taxonomy
|
from pycadf import cadftaxonomy as taxonomy
|
||||||
|
@ -573,8 +572,6 @@ class CadfRoleAssignmentNotificationWrapper(object):
|
||||||
|
|
||||||
def __init__(self, operation):
|
def __init__(self, operation):
|
||||||
self.action = '%s.%s' % (operation, self.ROLE_ASSIGNMENT)
|
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,
|
self.event_type = '%s.%s.%s' % (SERVICE, self.ROLE_ASSIGNMENT,
|
||||||
operation)
|
operation)
|
||||||
|
|
||||||
|
@ -632,29 +629,18 @@ class CadfRoleAssignmentNotificationWrapper(object):
|
||||||
audit_kwargs['inherited_to_projects'] = inherited
|
audit_kwargs['inherited_to_projects'] = inherited
|
||||||
audit_kwargs['role'] = role_id
|
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:
|
try:
|
||||||
result = f(wrapped_self, role_id, *args, **kwargs)
|
result = f(wrapped_self, role_id, *args, **kwargs)
|
||||||
except Exception:
|
except Exception:
|
||||||
for event_type in event_types:
|
|
||||||
_send_audit_notification(self.action, initiator,
|
_send_audit_notification(self.action, initiator,
|
||||||
taxonomy.OUTCOME_FAILURE,
|
taxonomy.OUTCOME_FAILURE,
|
||||||
target, event_type,
|
target, self.event_type,
|
||||||
**audit_kwargs)
|
**audit_kwargs)
|
||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
for event_type in event_types:
|
|
||||||
_send_audit_notification(self.action, initiator,
|
_send_audit_notification(self.action, initiator,
|
||||||
taxonomy.OUTCOME_SUCCESS,
|
taxonomy.OUTCOME_SUCCESS,
|
||||||
target, event_type,
|
target, self.event_type,
|
||||||
**audit_kwargs)
|
**audit_kwargs)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue