redfish: fixes usage of ValueDisplayName
It's spelled this way, not DisplayValueName. Change-Id: I170d78bdb7ed0f6c36a80a9f2ceb9629f44394ed
This commit is contained in:
parent
b7c16af45a
commit
9f1f58c6af
@ -54,20 +54,23 @@ class RedfishBIOS(base.BIOSInterface):
|
|||||||
driver='redfish',
|
driver='redfish',
|
||||||
reason=_("Unable to import the sushy library"))
|
reason=_("Unable to import the sushy library"))
|
||||||
|
|
||||||
def _parse_allowable_values(self, allowable_values):
|
def _parse_allowable_values(self, node, allowable_values):
|
||||||
"""Convert the BIOS registry allowable_value list to expected strings
|
"""Convert the BIOS registry allowable_value list to expected strings
|
||||||
|
|
||||||
:param allowable_values: list of dicts of valid values for enumeration
|
:param allowable_values: list of dicts of valid values for enumeration
|
||||||
:returns: list containing only allowable value names
|
:returns: list containing only allowable value names
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Get name from ValueName if it exists, otherwise use DisplayValueName
|
# Get name from ValueName if it exists, otherwise use ValueDisplayName
|
||||||
new_list = []
|
new_list = []
|
||||||
for dic in allowable_values:
|
for dic in allowable_values:
|
||||||
for key in dic:
|
key = dic.get('ValueName') or dic.get('ValueDisplayName')
|
||||||
if key == 'ValueName' or key == 'DisplayValueName':
|
if key:
|
||||||
new_list.append(dic[key])
|
new_list.append(key)
|
||||||
break
|
else:
|
||||||
|
LOG.warning('Cannot detect the value name for enumeration '
|
||||||
|
'item %(item)s for node %(node)s',
|
||||||
|
{'item': dic, 'node': node.uuid})
|
||||||
|
|
||||||
return new_list
|
return new_list
|
||||||
|
|
||||||
@ -129,7 +132,8 @@ class RedfishBIOS(base.BIOSInterface):
|
|||||||
setting[k] = getattr(reg, k, None)
|
setting[k] = getattr(reg, k, None)
|
||||||
if k == "allowable_values" and isinstance(setting[k],
|
if k == "allowable_values" and isinstance(setting[k],
|
||||||
list):
|
list):
|
||||||
setting[k] = self._parse_allowable_values(setting[k])
|
setting[k] = self._parse_allowable_values(
|
||||||
|
task.node, setting[k])
|
||||||
|
|
||||||
LOG.debug('Cache BIOS settings for node %(node_uuid)s',
|
LOG.debug('Cache BIOS settings for node %(node_uuid)s',
|
||||||
{'node_uuid': task.node.uuid})
|
{'node_uuid': task.node.uuid})
|
||||||
|
@ -597,7 +597,8 @@ class RedfishBiosRegistryTestCase(db_base.DbTestCase):
|
|||||||
self.registry.registry_entries.attributes[1].read_only = False
|
self.registry.registry_entries.attributes[1].read_only = False
|
||||||
self.registry.registry_entries.attributes[1].allowable_values =\
|
self.registry.registry_entries.attributes[1].allowable_values =\
|
||||||
[{'ValueName': 'Enabled', 'ValueDisplayName': 'Enabled'},
|
[{'ValueName': 'Enabled', 'ValueDisplayName': 'Enabled'},
|
||||||
{'ValueName': 'Disabled', 'ValueDisplayName': 'Disabled'}]
|
{'ValueDisplayName': 'Disabled'},
|
||||||
|
{'Invalid': 'banana'}]
|
||||||
self.registry.registry_entries.attributes[2].name = "BootDelay"
|
self.registry.registry_entries.attributes[2].name = "BootDelay"
|
||||||
self.registry.registry_entries.attributes[2].attribute_type = "Integer"
|
self.registry.registry_entries.attributes[2].attribute_type = "Integer"
|
||||||
self.registry.registry_entries.attributes[2].lower_bound = 5
|
self.registry.registry_entries.attributes[2].lower_bound = 5
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fixes detecting of allowable values for a BIOS settings enumeration in
|
||||||
|
the ``redfish`` BIOS interface when only ``ValueDisplayName`` is provided.
|
Loading…
Reference in New Issue
Block a user