From 7482692cdd44ddf7c5e69c746261bf0e298284ff Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 4 Feb 2025 14:08:03 -0500 Subject: [PATCH] Attempt to get half-working sysurl if broken For identify, there are implementations with partially broken system urls that are not good for general operation, but are still the only target for identify. Change-Id: I82f77e667974a57ee857082e6cbc98b78b818ccd --- pyghmi/redfish/command.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pyghmi/redfish/command.py b/pyghmi/redfish/command.py index 11056b33..109012c2 100644 --- a/pyghmi/redfish/command.py +++ b/pyghmi/redfish/command.py @@ -834,8 +834,18 @@ class Command(object): self._do_web_request(url, {'ResetType': action}) def set_identify(self, on=True, blink=None): + targurl = self.sysurl + if not targurl: + root = self._do_web_request('/redfish/v1') + systemsurl = root.get('Systems', {}).get('@odata.id', None) + if systemsurl: + targurl = self._do_web_request(systemsurl) + if len(targurl.get('Members', [])) == 1: + targurl = targurl['Members'][0]['@odata.id'] + if not targurl: + raise Exception("Unable to identify system url") self._do_web_request( - self.sysurl, + targurl, {'IndicatorLED': 'Blinking' if blink else 'Lit' if on else 'Off'}, method='PATCH', etag='*')