changeset 4287:ff88a807852d

plugin identity: disco identity is now added in identity metadata: rel 447
author Goffi <goffi@goffi.org>
date Mon, 29 Jul 2024 03:30:53 +0200
parents 96fdf4891747
children f46891f2c9cb
files libervia/backend/plugins/plugin_misc_identity.py
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/backend/plugins/plugin_misc_identity.py	Mon Jul 29 03:29:14 2024 +0200
+++ b/libervia/backend/plugins/plugin_misc_identity.py	Mon Jul 29 03:30:53 2024 +0200
@@ -733,7 +733,8 @@
             should be True most of time, to avoid useless network requests
         @return: identity data
         """
-        id_data = {}
+        identities = []
+        id_data = {"identities": identities}
 
         if not metadata_filter:
             metadata_names = self.metadata.keys()
@@ -745,6 +746,15 @@
                 client, metadata_name, entity, use_cache
             )
 
+        if entity is not None:
+            try:
+                disco_infos = await self.host.memory.disco.get_infos(client, entity)
+            except Exception as e:
+                log.exception(f"Can't get disco infos for {entity}.")
+            else:
+                for (category, type_), name in disco_infos.identities.items():
+                    identities.append({"category": category, "type": type_, "name": name})
+
         return id_data
 
     def _get_identities(self, entities_s, metadata_filter, profile):