Skip to content

Commit

Permalink
Added exception for missing property in event handler
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Pinto <christian.pinto@ibm.com>
  • Loading branch information
christian-pinto committed Mar 7, 2024
1 parent 9e1f24e commit 78344d8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sunfish/events/redfish_event_handler.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 78344d8

Please sign in to comment.