aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Moravec <pmoravec@redhat.com>2024-03-19 12:26:18 +0100
committerJake Hunsaker <jacob.r.hunsaker@gmail.com>2024-03-19 13:12:30 -0400
commit7370e715e6e86598566afe4bdae290ee85c6fc23 (patch)
tree0663960ed71f1308932597149c57fba4eb90a299
parent6112224463c29a96a891e21ce911950fb14d903c (diff)
downloadsos-7370e715e6e86598566afe4bdae290ee85c6fc23.tar.gz
[cleaner] Improve stripping raw MAC address
reduce_mac_match should strip all characters that cant appear in a MAC address string. Currently it forgets to strip e.g. from "mac:01:02:03:04:05" anything. We should strip at least the 'm'. Ideally whole "mac" but that would be programatically difficult to describe proper condition for that. Resolves: #3574 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
-rw-r--r--sos/cleaner/parsers/mac_parser.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/sos/cleaner/parsers/mac_parser.py b/sos/cleaner/parsers/mac_parser.py
index 74f95a6a..78e40c3d 100644
--- a/sos/cleaner/parsers/mac_parser.py
+++ b/sos/cleaner/parsers/mac_parser.py
@@ -57,9 +57,9 @@ class SoSMacParser(SoSCleanerParser):
"""Strips away leading and trailing non-alphanum characters from any
matched string to leave us with just the bare MAC addr
"""
- while not (match[0].isdigit() or match[0].isalpha()):
+ while not match[0] in '0123456789abcdefABCDEF':
match = match[1:]
- while not (match[-1].isdigit() or match[-1].isalpha()):
+ while not match[-1] in '0123456789abcdefABCDEF':
match = match[0:-1]
# just to be safe, call strip() to remove any padding
return match.strip()