From d9d9fa3df72609f4d808abb7ef4e2abe93ef2d48 Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Thu, 13 Aug 2026 23:50:41 +0200 Subject: [PATCH] Say which resource a transport does not implement The unhandled tails of handle_request, handle_configuration and handle_alerts raised a bare Exception('Not implemented'), so asking for a resource the transport has no code for was reported as an unexpected error and logged with a traceback. management_controller/location over ipmi is one such resource: R5 implemented it for redfish only. Raise UnsupportedFunctionality naming the resource instead, which the plugins already treat as its own case rather than a fault, and give decode_alert over redfish the same treatment. Any resource added to the tree without an implementation on one transport now reports that plainly. --- .../plugins/hardwaremanagement/ipmi.py | 17 ++++++++++++++--- .../plugins/hardwaremanagement/redfish.py | 18 +++++++++++++++--- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py index f59fbb3c..b7916362 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py @@ -554,6 +554,17 @@ class IpmiHandler: self.ipmicmd = ipmicmd self.loggedin = True + def _unsupported(self): + """Say that the requested resource has no ipmi implementation. + + Falling through to a bare exception would be reported as an unexpected + error and logged with a traceback, when all that happened is that this + transport does not offer the resource. + """ + return pygexc.UnsupportedFunctionality( + '"{0}" is not implemented for ipmi'.format( + '/'.join([str(x) for x in self.element]))) + async def handle_request(self): if self.broken: if (self.error == 'timeout' or @@ -622,7 +633,7 @@ class IpmiHandler: elif self.element == ['console', 'ikvm']: await self.handle_ikvm() else: - raise Exception('Not Implemented') + raise self._unsupported() async def handle_update(self): u = firmwaremanager.Updater(self.node, self.ipmicmd.update_firmware, @@ -703,7 +714,7 @@ class IpmiHandler: return await self.handle_licenses() elif self.element[1:3] == ['management_controller', 'save_licenses']: return await self.save_licenses() - raise Exception('Not implemented') + raise self._unsupported() async def decode_alert(self): inputdata = self.inputdata.get_alert(self.node) @@ -754,7 +765,7 @@ class IpmiHandler: elif self.op == 'delete': await self.ipmicmd.clear_alert_destination(alertidx) return - raise Exception('Not implemented') + raise self._unsupported() async def handle_nets(self): if len(self.element) == 3: diff --git a/confluent_server/confluent/plugins/hardwaremanagement/redfish.py b/confluent_server/confluent/plugins/hardwaremanagement/redfish.py index 6c276d30..89c5a13e 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/redfish.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/redfish.py @@ -428,6 +428,17 @@ class IpmiHandler: } + def _unsupported(self): + """Say that the requested resource has no redfish implementation. + + Falling through to a bare exception would be reported as an unexpected + error and logged with a traceback, when all that happened is that this + transport does not offer the resource. + """ + return pygexc.UnsupportedFunctionality( + '"{0}" is not implemented for redfish'.format( + '/'.join([str(x) for x in self.element]))) + async def handle_request(self): if self.broken: if (self.error == 'timeout' or @@ -494,7 +505,7 @@ class IpmiHandler: elif self.element == ['console', 'ikvm']: await self.handle_ikvm() else: - raise Exception('Not Implemented') + raise self._unsupported() async def update_firmware(self, filename, progress, data, bank): params=() @@ -590,10 +601,11 @@ class IpmiHandler: return await self.handle_licenses() elif self.element[1:3] == ['management_controller', 'save_licenses']: return await self.save_licenses() - raise Exception('Not implemented') + raise self._unsupported() def decode_alert(self): - raise Exception("Decode Alert not implemented for redfish") + raise pygexc.UnsupportedFunctionality( + 'Decoding an alert is not implemented for redfish') async def handle_cert_authorities(self): if len(self.element) == 3: