From ea676265a174dedac4f5c83118059dec9e689670 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 28 Jun 2019 11:24:27 -0400 Subject: [PATCH] Fix set system configuration The displaytoval mapping was not consulted, resulting in incorrect values being requested. Change-Id: Iad88b7976f3f986009fcb939b68bbc7902204804 --- pyghmi/redfish/command.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pyghmi/redfish/command.py b/pyghmi/redfish/command.py index 42fed50d..a4657037 100644 --- a/pyghmi/redfish/command.py +++ b/pyghmi/redfish/command.py @@ -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')