From 06449b50d4723d66be45977c8e27f3234ea9a544 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Tue, 23 Jan 2024 09:36:00 +0000 Subject: [PATCH] node-proxy: add new attribute to BaseRedfishSystem() This adds `self.component_list()` in order to parametrize which categories the agent will collect. Signed-off-by: Guillaume Abrioux (cherry picked from commit b49216bf8bb01fc8f11f4575cca644bd3ead5f5a) --- .../ceph_node_proxy/baseredfishsystem.py | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/ceph-node-proxy/ceph_node_proxy/baseredfishsystem.py b/src/ceph-node-proxy/ceph_node_proxy/baseredfishsystem.py index 74d9219d1ce54..e80523fed1850 100644 --- a/src/ceph-node-proxy/ceph_node_proxy/baseredfishsystem.py +++ b/src/ceph-node-proxy/ceph_node_proxy/baseredfishsystem.py @@ -35,6 +35,20 @@ class BaseRedfishSystem(BaseSystem): self.job_service_endpoint: str = '' self.create_reboot_job_endpoint: str = '' self.setup_job_queue_endpoint: str = '' + self.component_list: List[str] = kw.get('component_list', ['memory', + 'power', + 'fans', + 'network', + 'processors', + 'storage', + 'firmwares']) + self.update_funcs: List[Callable] = [] + for component in self.component_list: + self.log.logger.debug(f'adding: {component} to hw component gathered list.') + func = f'_update_{component}' + if hasattr(self, func): + f = getattr(self, func) + self.update_funcs.append(f) self.start_client() @@ -61,16 +75,9 @@ class BaseRedfishSystem(BaseSystem): try: self._update_system() self._update_sn() - update_funcs = [self._update_memory, - self._update_power, - self._update_fans, - self._update_network, - self._update_processors, - self._update_storage, - self._update_firmwares] with concurrent.futures.ThreadPoolExecutor() as executor: - executor.map(lambda f: f(), update_funcs) + executor.map(lambda f: f(), self.update_funcs) self.data_ready = True except RuntimeError as e: -- 2.39.5