From 2df9cbbe99978823d3712397881deb2ccb9eb96e Mon Sep 17 00:00:00 2001 From: Quan Zhou Date: Thu, 29 Aug 2024 17:00:23 +0200 Subject: [PATCH] [enrich] Avoid "-- UNDEFINED --" values 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 --- grimoire_elk/enriched/enrich.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/grimoire_elk/enriched/enrich.py b/grimoire_elk/enriched/enrich.py index f309f5635..29663bfec 100644 --- a/grimoire_elk/enriched/enrich.py +++ b/grimoire_elk/enriched/enrich.py @@ -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: @@ -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']: