From eb742c57013d7e244e259b3e9c9cc779871eb9ac Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Fri, 14 Aug 2026 17:43:11 +0200 Subject: [PATCH] Let a virtual media insert report why it failed Any failure fell back to setting the properties, so the property set's complaint replaced the real reason. --- confluent_server/aiohmi/redfish/command.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/confluent_server/aiohmi/redfish/command.py b/confluent_server/aiohmi/redfish/command.py index d6dbf1fa..d6bdc76f 100644 --- a/confluent_server/aiohmi/redfish/command.py +++ b/confluent_server/aiohmi/redfish/command.py @@ -1648,6 +1648,20 @@ class Command(object): """ return self._oem.check_storage_configuration(cfgspec) + # How an implementation says an action it advertised is not there, as + # opposed to refusing what was asked of it + _absentmsgids = ('ActionNotSupported', 'ResourceMissingAtURI', + 'ResourceNotFound') + + def _action_absent(self, theexc): + """Whether a failed action call means the action is not served.""" + msgid = getattr(theexc, 'msgid', None) + if msgid is None: + # Not a redfish error at all, which is not how one that serves the + # action reports refusing + return True + return any(x in str(msgid) for x in self._absentmsgids) + async def attach_remote_media(self, url, username=None, password=None): """Attach remote media by url @@ -1704,7 +1718,11 @@ class Command(object): try: await self._do_web_request(inserturl, {'Image': url}) attached = True - except (exc.RedfishError, exc.PyghmiException): + except exc.PyghmiException as pe: + if not self._action_absent(pe): + # The action is there and refused; that reason is the + # one worth passing on + raise # Some implementations advertise the insert action without # serving it, so fall back to setting the properties inserturl = None