From 8db1d9accc8079c6653099ac2b22c5151e5ac209 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Wed, 5 Apr 2023 14:10:41 +0200 Subject: [PATCH] node-proxy: variabilize the system_endpoint This makes it possible to define the value of the 'System endpoint'. This can be different according to the hardware. This probably means that the class `RedfishSystem` should be split itself. Signed-off-by: Guillaume Abrioux (cherry picked from commit e80cd0286a34a352fc098d72a9740e25156de9a8) --- src/cephadm/node-proxy/redfish_system.py | 9 +++++++-- src/cephadm/node-proxy/server.py | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/cephadm/node-proxy/redfish_system.py b/src/cephadm/node-proxy/redfish_system.py index 07f9cd69973..e4a59320768 100644 --- a/src/cephadm/node-proxy/redfish_system.py +++ b/src/cephadm/node-proxy/redfish_system.py @@ -9,13 +9,18 @@ log = logger(__name__) class RedfishSystem(System): - def __init__(self, host, username, password): + def __init__(self, + host, + username, + password, + system_endpoint='/Systems/1'): log.info(f"redfish system initialization, host: {host}, user: {username}") self.client = RedFishClient(host, username, password) self.client.login() self._system = {} self.run = False self.thread = None + self.system_endpoint = system_endpoint def get_system(self): return self._system @@ -45,7 +50,7 @@ class RedfishSystem(System): return redfish_system def _update_system(self): - redfish_system = self.client.get_path('/Systems/1') + redfish_system = self.client.get_path(self.system_endpoint) self._system = self._process_redfish_system(redfish_system) def _update_metadata(self): diff --git a/src/cephadm/node-proxy/server.py b/src/cephadm/node-proxy/server.py index 14c8db941ee..582a5e61575 100644 --- a/src/cephadm/node-proxy/server.py +++ b/src/cephadm/node-proxy/server.py @@ -13,8 +13,8 @@ username = "myuser" password = "mypassword" # create the redfish system and the obsever -system = RedfishSystem(host, username, password) log.info(f"Server initialization...") +system = RedfishSystem(host, username, password, system_endpoint='/Systems/System.Embedded.1') reporter_agent = Reporter(system, "http://127.0.0.1:8000") app = Flask(__name__) -- 2.39.5