2
0
mirror of https://opendev.org/x/pyghmi synced 2026-03-28 13:53:30 +00:00

Improve consistency with Lenovo tools

Lenovo tools use mriName to label configuration groups.  Change to this
by default, while retaining legacy name
as alias for backwards compatibility.

Change-Id: I220ab18e21947745cf942d78536668d580ffa38b
This commit is contained in:
Jarrod Johnson
2019-02-20 11:14:16 -05:00
parent d88b508e71
commit 57d4db40ca
2 changed files with 11 additions and 2 deletions

View File

@@ -273,6 +273,8 @@ class LenovoFirmwareConfig(object):
if lenovo_id == 'iSCSI':
# Do not support iSCSI at this time
continue
cfglabel = config.find('mriName')
cfglabel = lenovo_id if cfglabel is None else cfglabel.text
for group in config.iter("group"):
lenovo_group = group.get("ID")
for setting in group.iter("setting"):
@@ -353,7 +355,8 @@ class LenovoFirmwareConfig(object):
default = []
for order in sorted(currentdef):
default.append(currentdef[order])
optionname = "%s.%s" % (lenovo_id, name)
optionname = "%s.%s" % (cfglabel, name)
alias = "%s.%s" % (lenovo_id, name)
options[optionname] = dict(current=current,
default=default,
possible=possible,
@@ -370,7 +373,8 @@ class LenovoFirmwareConfig(object):
readonly_expression=readonly,
hide_expression=hide,
sortid=sortid,
lenovo_instance="")
lenovo_instance="",
alias=alias)
sortid = sortid + 1
for opt in options:
opt = options[opt]

View File

@@ -201,6 +201,11 @@ class IMMClient(object):
if fnmatch.fnmatch(rkey.lower(), key.lower()):
changeset[rkey] = changeset[key]
found = True
elif self.fwo[rkey].get('alias', None) != rkey:
calias = self.fwo[rkey]['alias']
if fnmatch.fnmatch(calias.lower(), key.lower()):
changeset[rkey] = changeset[key]
found = True
if found:
del changeset[key]
else: