2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-27 19:37:44 +00:00

Accept wildcards for settings names

For some settings, it is very helpful to be able to take wildcards.
Honor those and have those potentially replicate across multiple
matches.

Change-Id: I9ebfb2a4686b5f822527be9b05b59ca9df1e3caf
This commit is contained in:
Jarrod Johnson 2018-08-30 10:21:30 -04:00
parent f9d784f417
commit 576a5f1729

View File

@ -17,6 +17,7 @@
import base64
from datetime import datetime
import errno
import fnmatch
import json
import os.path
import pyghmi.constants as pygconst
@ -176,11 +177,13 @@ class IMMClient(object):
self.fwovintage = util._monotonic_time()
for key in list(changeset):
if key not in self.fwo:
found = False
for rkey in self.fwo:
if rkey.lower() == key.lower():
if fnmatch.fnmatch(rkey.lower(), key.lower()):
changeset[rkey] = changeset[key]
del changeset[key]
break
found = True
if found:
del changeset[key]
else:
raise pygexc.InvalidParameterValue(
'{0} not a known setting'.format(key))