From: Guillaume Abrioux Date: Wed, 5 Apr 2023 12:10:41 +0000 (+0200) Subject: node-proxy: variabilize the system_endpoint X-Git-Tag: v18.2.4~314^2~117 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8db1d9accc8079c6653099ac2b22c5151e5ac209;p=ceph.git 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) --- diff --git a/src/cephadm/node-proxy/redfish_system.py b/src/cephadm/node-proxy/redfish_system.py index 07f9cd69973a..e4a59320768c 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 14c8db941ee7..582a5e615758 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__)