2
0
mirror of https://opendev.org/x/pyghmi synced 2026-06-11 17:28:53 +00:00

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
This commit is contained in:
Jarrod Johnson
2025-02-04 14:08:03 -05:00
parent 1bf95406b5
commit 7482692cdd
+11 -1
View File
@@ -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='*')