2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-28 11:57:34 +00:00

Fix set system configuration

The displaytoval mapping was not consulted,
resulting in incorrect values being
requested.

Change-Id: Iad88b7976f3f986009fcb939b68bbc7902204804
This commit is contained in:
Jarrod Johnson 2019-06-28 11:24:27 -04:00
parent e864f4fd19
commit ea676265a1

View File

@ -790,7 +790,11 @@ class Command(object):
return addon, valtodisplay, displaytoval, reg
def get_system_configuration(self, hideadvanced=True):
return self._getsyscfg()[0]
def _getsyscfg(self):
biosinfo = self._do_web_request(self._biosurl, cache=False)
reginfo = None
extrainfo = {}
valtodisplay = {}
self.attrdeps = []
@ -839,7 +843,7 @@ class Command(object):
val['active'] = currval
val.update(**extrainfo.get(setting, {}))
currsettings[setting] = val
return currsettings
return currsettings, reginfo
def clear_system_configuration(self):
"""Clear the BIOS/UEFI configuration
@ -853,7 +857,7 @@ class Command(object):
self._do_web_request(rb, {'Action': 'Bios.ResetBios'})
def set_system_configuration(self, changeset):
currsettings = self.get_system_configuration()
currsettings, reginfo = self._getsyscfg()
rawsettings = self._do_web_request(self._biosurl, cache=False)
rawsettings = rawsettings.get('Attributes', {})
pendingsettings = self._do_web_request(self._setbiosurl)
@ -899,6 +903,8 @@ class Command(object):
'({2})'.format(
changeval, change,
','.join(currsettings[change]['possible'])))
if changeset[change] in reginfo[2].get(change, {}):
changeset[change] = reginfo[2][change][changeset[change]]
redfishsettings = {'Attributes': changeset}
self._do_web_request(self._setbiosurl, redfishsettings, 'PATCH')