Skip to content

Commit

Permalink
[enrich] Avoid "-- UNDEFINED --" values
Browse files Browse the repository at this point in the history
This commit keeps the name, email, id, and uuid values instead of
`-- UNDEFINED --` when Mordred loses connection to the SortingHat
server during the enrichment phase.

Signed-off-by: Quan Zhou <[email protected]>
  • Loading branch information
zhquan committed Aug 29, 2024
1 parent 86a4d8f commit 2df9cbb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions grimoire_elk/enriched/enrich.py
Original file line number Diff line number Diff line change
Expand Up @@ -826,13 +826,16 @@ def get_sh_item_from_identity_cache(self, identity_tuple, backend_name):
email=iden['email'],
name=iden['name'],
username=iden['username'])
iden['uuid'] = identity_id
iden['id'] = identity_id
iden['enrollments'] = []

try:
individual = self.get_entity(identity_id)
if not individual:
msg = "Individual not found given the following identity: {}".format(identity_id)
logger.debug(msg)
return sh_item
return iden

for indv_identity in individual['identities']:
if indv_identity['uuid'] == identity_id:
Expand Down Expand Up @@ -1054,7 +1057,6 @@ def get_item_sh(self, item, roles=None, date_field=None):
sh_fields = self.get_item_sh_fields(identity, item_date, rol=rol)
else:
sh_fields = self.get_item_no_sh_fields(identity, rol)

eitem_sh.update(sh_fields)

if not eitem_sh[rol + '_org_name']:
Expand Down

0 comments on commit 2df9cbb

Please sign in to comment.