From e07c4803a67da67e12736b89260dbf07b8cb7618 Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Fri, 17 Apr 2015 13:23:31 +0200 Subject: [PATCH] Minor fix on clean `re.match` matches from the start of the line, while we are actually looking for anywhere in the key ('system-serial' won't match on `match`, but will on `search`) --- salt/modules/smbios.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/salt/modules/smbios.py b/salt/modules/smbios.py index 619898abde..fb8015c577 100644 --- a/salt/modules/smbios.py +++ b/salt/modules/smbios.py @@ -296,7 +296,7 @@ def _dmi_isclean(key, val): continue log.trace('DMI {0} value {1} is an invalid UUID'.format(key, val.replace('\n', ' '))) return False - elif re.match('serial|part|version', key): + elif re.search('serial|part|version', key): # 'To be filled by O.E.M. # 'Not specified' etc. # 0000000, 1234667 etc. @@ -304,7 +304,7 @@ def _dmi_isclean(key, val): return not re.match(r'^[0]+$', val) \ and not re.match(r'[0]?1234567[8]?[9]?[0]?', val) \ and not re.search(r'sernum|part[_-]?number|specified|filled', val, flags=re.IGNORECASE) - elif 'asset' in key or 'manufacturer' in key: + elif re.search('asset|manufacturer', key): # AssetTag0. Manufacturer04. Begone. return not re.search(r'manufacturer|to be filled|available|asset|^no(ne|t)', val, flags=re.IGNORECASE) else: