aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Moravec <pmoravec@redhat.com>2018-07-27 08:56:37 +0200
committerBryn M. Reeves <bmr@redhat.com>2018-08-10 17:21:08 +0100
commitbc650cd161548159e551ddc201596bf19b1865d0 (patch)
tree5a2351831aa106259df06916f79a23bbdd2c74a3
parentecfe92e1115f8a2ac37f6c683212eb14883a8f5c (diff)
downloadsos-bc650cd161548159e551ddc201596bf19b1865d0.tar.gz
[policies] sanitize report label
similarly like we sanitize case id, we should sanitize report label to e.g. exclude spaces from final tarball name. Resolves: #1389 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
-rw-r--r--sos/policies/__init__.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py
index 7b301dec..65d8aac6 100644
--- a/sos/policies/__init__.py
+++ b/sos/policies/__init__.py
@@ -408,7 +408,7 @@ No changes will be made to system configuration.
date=date,
rand=rand
)
- return time.strftime(nstr)
+ return self.sanitize_filename(time.strftime(nstr))
# for some specific binaries like "xz", we need to determine package
# providing it; that is policy specific. By default return the binary
@@ -726,8 +726,8 @@ class LinuxPolicy(Policy):
"""Returns the name usd in the pre_work step"""
return self.host_name()
- def sanitize_case_id(self, case_id):
- return re.sub(r"[^-a-z,A-Z.0-9]", "", case_id)
+ def sanitize_filename(self, name):
+ return re.sub(r"[^-a-z,A-Z.0-9]", "", name)
def lsmod(self):
"""Return a list of kernel module names as strings.
@@ -755,9 +755,6 @@ class LinuxPolicy(Policy):
if cmdline_opts.case_id:
self.case_id = cmdline_opts.case_id
- if self.case_id:
- self.case_id = self.sanitize_case_id(self.case_id)
-
return