aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sos/cleaner/__init__.py12
-rw-r--r--sos/cleaner/obfuscation_archive.py28
2 files changed, 21 insertions, 19 deletions
diff --git a/sos/cleaner/__init__.py b/sos/cleaner/__init__.py
index 8c07a3ea..4a4e5959 100644
--- a/sos/cleaner/__init__.py
+++ b/sos/cleaner/__init__.py
@@ -445,11 +445,12 @@ third party.
file_list = archive.get_file_list()
for fname in file_list:
- short_name = fname.split(archive.archive_name)[1]
+ short_name = fname.split(archive.archive_name)[1].lstrip('/')
if archive.should_skip_file(short_name):
continue
try:
- count = self.obfuscate_file(fname, short_name)
+ count = self.obfuscate_file(fname, short_name,
+ archive.archive_name)
if count:
archive.update_sub_count(short_name, count)
except Exception as err:
@@ -522,12 +523,13 @@ third party.
if not filename:
# the requested file doesn't exist in the archive
return
- self.log_debug("Obfuscating %s" % filename)
+ self.log_debug("Obfuscating %s" % short_name or filename,
+ caller=arc_name)
subs = 0
tfile = tempfile.NamedTemporaryFile(mode='w', dir=self.tmpdir)
with open(filename, 'r') as fname:
for line in fname:
- if not line.strip() or line.startswith('#'):
+ if not line.strip():
continue
try:
line, count = self.obfuscate_line(line, short_name)
@@ -535,7 +537,7 @@ third party.
tfile.write(line)
except Exception as err:
self.log_debug("Unable to obfuscate %s: %s"
- % (filename, err))
+ % (short_name, err), caller=arc_name)
tfile.seek(0)
if subs:
shutil.copy(tfile.name, filename)
diff --git a/sos/cleaner/obfuscation_archive.py b/sos/cleaner/obfuscation_archive.py
index 848b0133..283bee50 100644
--- a/sos/cleaner/obfuscation_archive.py
+++ b/sos/cleaner/obfuscation_archive.py
@@ -58,20 +58,20 @@ class SoSObfuscationArchive():
Returns: list of files and file regexes
"""
return [
- '/installed-debs',
- '/installed-rpms',
- '/sos_commands/dpkg',
- '/sos_commands/python/pip_list',
- '/sos_commands/rpm',
- '/sos_commands/yum/.*list.*',
- '/sos_commands/snappy/snap_list_--all',
- '/sos_commands/snappy/snap_--version',
- '/sos_commands/vulkan/vulkaninfo',
- '/sys/firmware',
- '/sys/fs',
- '/sys/kernel/debug',
- '/sys/module',
- '/var/log/.*dnf.*',
+ 'installed-debs',
+ 'installed-rpms',
+ 'sos_commands/dpkg',
+ 'sos_commands/python/pip_list',
+ 'sos_commands/rpm',
+ 'sos_commands/yum/.*list.*',
+ 'sos_commands/snappy/snap_list_--all',
+ 'sos_commands/snappy/snap_--version',
+ 'sos_commands/vulkan/vulkaninfo',
+ 'sys/firmware',
+ 'sys/fs',
+ 'sys/kernel/debug',
+ 'sys/module',
+ 'var/log/.*dnf.*',
'.*.tar.*', # TODO: support archive unpacking
'.*.gz'
]