diff --git a/keystone/notifications.py b/keystone/notifications.py index a59b1d0ba2..7bd54cb6fd 100644 --- a/keystone/notifications.py +++ b/keystone/notifications.py @@ -833,6 +833,8 @@ def _add_username_to_initiator(initiator): return initiator try: user_ref = PROVIDERS.identity_api.get_user(initiator.user_id) + # NOTE(jake): name should be used, username kept for compatibility + initiator.name = user_ref['name'] initiator.username = user_ref['name'] except (exception.UserNotFound, AttributeError): # Either user not found or no user_id, move along diff --git a/keystone/tests/unit/common/test_notifications.py b/keystone/tests/unit/common/test_notifications.py index 8b6d6df984..78c204d95f 100644 --- a/keystone/tests/unit/common/test_notifications.py +++ b/keystone/tests/unit/common/test_notifications.py @@ -1156,7 +1156,7 @@ class CadfNotificationsWrapperTestCase(test_v3.RestfulTestCase): 'typeURI': 'service/security/account/user', 'host': {'address': 'localhost'}, 'id': 'openstack:0a90d95d-582c-4efb-9cbc-e2ca7ca9c341', - 'username': u'admin' + 'name': 'admin' }, 'target': { 'typeURI': 'service/security/account/user', @@ -1211,6 +1211,7 @@ class CadfNotificationsWrapperTestCase(test_v3.RestfulTestCase): self.assertEqual(len(self._notifications), 1) note = self._notifications.pop() initiator = note['initiator'] + self.assertEqual(self.user['name'], initiator.name) self.assertEqual(self.user['name'], initiator.username) def test_v3_authenticate_user_name_and_domain_id(self):