From 576a5f1729b8fba4952756f4f337ac256b7afe4b Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 30 Aug 2018 10:21:30 -0400 Subject: [PATCH] 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 --- pyghmi/ipmi/oem/lenovo/imm.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py index bb0d6b14..736b5474 100644 --- a/pyghmi/ipmi/oem/lenovo/imm.py +++ b/pyghmi/ipmi/oem/lenovo/imm.py @@ -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))