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:
@@ -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='*')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user