From 78344d81ab2099de306ee516472a0b4c129a8da2 Mon Sep 17 00:00:00 2001 From: Christian Pinto Date: Thu, 7 Mar 2024 15:47:45 +0000 Subject: [PATCH] Added exception for missing property in event handler Signed-off-by: Christian Pinto --- sunfish/events/redfish_event_handler.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sunfish/events/redfish_event_handler.py b/sunfish/events/redfish_event_handler.py index 35fbf00..990acba 100644 --- a/sunfish/events/redfish_event_handler.py +++ b/sunfish/events/redfish_event_handler.py @@ -1,6 +1,7 @@ # Copyright IBM Corp. 2023 # This software is available to you under a BSD 3-Clause License. # The full license terms are available here: https://github.com/OpenFabrics/sunfish_library_reference/blob/main/LICENSE +import json import logging import os from uuid import uuid4 @@ -331,6 +332,8 @@ def fetchResource(self, obj_id, aggregation_source): def createInspectedObject(self,redfish_obj, aggregation_source): if '@odata.id' in redfish_obj: obj_path = os.path.relpath(redfish_obj['@odata.id'], self.conf['redfish_root']) + else: + raise PropertyNotFound(f"missing @odata.id in \n {json.dumps(redfish_obj, indent=2)}") file_path = os.path.join(self.conf['redfish_root'], obj_path) #file_path = create_path(constants.PATHS['Root'], obj_path)