Merge "Fix inconsistency in CADF initiator name field"

This commit is contained in:
Zuul authored and Gerrit Code Review committed 2025-06-13 15:37:09 +00:00
commit 7715b9d2bd
2 files changed
+4 -1

No files matched your search

+2
View File
@@ -1053,6 +1053,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
@@ -1566,7 +1566,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',
@@ -1621,6 +1621,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):