Skip to content

Commit

Permalink
[enrich] Avoid "-- UNDEFINED --" values
Browse files Browse the repository at this point in the history
Avoid `-- UNIDEFINED --` values for all SortingHat fields when
Mordred loses connection to the SortingHat server during the
enrichment or autorefresh execution. It will keep the values
​of the `name`, `email`, `id` and `uuid` fields.

Signed-off-by: Quan Zhou <quan@bitergia.com>
  • Loading branch information
zhquan committed Aug 29, 2024
1 parent 86a4d8f commit 21aec73
Show file tree
Hide file tree
Showing 2 changed files with 14 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
10 changes: 10 additions & 0 deletions releases/unreleased/avoid-'---undefined---'-values.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Avoid '-- UNDEFINED --' values
category: fixed
author: Quan Zhou <quan@bitergia.com>
issue: null
notes: >
Avoid `-- UNIDEFINED --` values for all SortingHat fields when
Mordred loses connection to the SortingHat server during the
enrichment or autorefresh execution. It will keep the values
​of the `name`, `email`, `id` and `uuid` fields.

0 comments on commit 21aec73

Please sign in to comment.