2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-08-26 08:36:43 +00:00

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.
This commit is contained in:
Markus Hilger
2026-08-13 23:50:41 +02:00
parent f6ba3802bc
commit d9d9fa3df7
2 changed files with 29 additions and 6 deletions
@@ -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:
@@ -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: