]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
node-proxy: variabilize the system_endpoint
authorGuillaume Abrioux <gabrioux@ibm.com>
Wed, 5 Apr 2023 12:10:41 +0000 (14:10 +0200)
committerGuillaume Abrioux <gabrioux@ibm.com>
Thu, 25 Jan 2024 14:43:29 +0000 (14:43 +0000)
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 <gabrioux@ibm.com>
src/cephadm/node-proxy/redfish_system.py
src/cephadm/node-proxy/server.py

index 07f9cd69973af12e4ed49088f6261456fe23fe69..e4a59320768c930543a129e9701b5edc911ca7cf 100644 (file)
@@ -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):
index 14c8db941ee77c631d7919f6fbd9d327ed80eb28..582a5e61575826174a68fe1dffe3c9dd83794109 100644 (file)
@@ -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__)