diff options
author | Pavel Moravec <pmoravec@redhat.com> | 2024-01-28 14:54:46 +0100 |
---|---|---|
committer | Jake Hunsaker <jacob.r.hunsaker@gmail.com> | 2024-02-17 11:31:05 -0500 |
commit | 7b84e8a75eaafbb9f9e07cd6da1ef09f1bbf7896 (patch) | |
tree | de81ec1e6048ab9f7cce6165f5ae2a9ed6f5a4a0 | |
parent | e306dd93ba5b7a431e23dc4f1af2b65e59267076 (diff) | |
download | sos-7b84e8a75eaafbb9f9e07cd6da1ef09f1bbf7896.tar.gz |
[cleaner] Skip obfuscation for short strings in some mappings
Obfuscation of entries like "map" or "po" is redundant and rather causes
user confusion and longer cleaner run.
Stop obfuscating those strings in relevant mappings (only).
Relevant: #3403
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
-rw-r--r-- | sos/cleaner/mappings/__init__.py | 4 | ||||
-rw-r--r-- | sos/cleaner/mappings/hostname_map.py | 1 | ||||
-rw-r--r-- | sos/cleaner/mappings/username_map.py | 1 |
3 files changed, 5 insertions, 1 deletions
diff --git a/sos/cleaner/mappings/__init__.py b/sos/cleaner/mappings/__init__.py index 1cb41a43..b56ced40 100644 --- a/sos/cleaner/mappings/__init__.py +++ b/sos/cleaner/mappings/__init__.py @@ -25,6 +25,7 @@ class SoSMap(): # used for filename obfuscations in parser.parse_string_for_keys() skip_keys = [] compile_regexes = True + ignore_short_items = False def __init__(self): self.dataset = {} @@ -36,7 +37,8 @@ class SoSMap(): """Some items need to be completely ignored, for example link-local or loopback addresses should not be obfuscated """ - if not item or item in self.skip_keys or item in self.dataset.values(): + if not item or item in self.skip_keys or item in self.dataset.values()\ + or (self.ignore_short_items and len(item) <= 3): return True for skip in self.ignore_matches: if re.match(skip, item, re.I): diff --git a/sos/cleaner/mappings/hostname_map.py b/sos/cleaner/mappings/hostname_map.py index 7bbf1529..ca26125c 100644 --- a/sos/cleaner/mappings/hostname_map.py +++ b/sos/cleaner/mappings/hostname_map.py @@ -43,6 +43,7 @@ class SoSHostnameMap(SoSMap): strip_exts = ('.yaml', '.yml', '.crt', '.key', '.pem', '.log', '.repo', '.rules', '.conf', '.cfg') + ignore_short_items = True host_count = 0 domain_count = 0 _domains = {} diff --git a/sos/cleaner/mappings/username_map.py b/sos/cleaner/mappings/username_map.py index db12e788..e1ef026c 100644 --- a/sos/cleaner/mappings/username_map.py +++ b/sos/cleaner/mappings/username_map.py @@ -20,6 +20,7 @@ class SoSUsernameMap(SoSMap): Note that this specifically obfuscates user_names_ and not UIDs. """ + ignore_short_items = True name_count = 0 def sanitize_item(self, username): |