Blame SOURCES/sos-bz1608384-archive-name-sanitize.patch

c33036
From bc650cd161548159e551ddc201596bf19b1865d0 Mon Sep 17 00:00:00 2001
c33036
From: Pavel Moravec <pmoravec@redhat.com>
c33036
Date: Fri, 27 Jul 2018 08:56:37 +0200
c33036
Subject: [PATCH] [policies] sanitize report label
c33036
c33036
similarly like we sanitize case id, we should sanitize report label
c33036
to e.g. exclude spaces from final tarball name.
c33036
c33036
Resolves: #1389
c33036
c33036
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
c33036
---
c33036
 sos/policies/__init__.py | 9 +++------
c33036
 1 file changed, 3 insertions(+), 6 deletions(-)
c33036
c33036
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py
c33036
index 7b301dec..65d8aac6 100644
c33036
--- a/sos/policies/__init__.py
c33036
+++ b/sos/policies/__init__.py
c33036
@@ -408,7 +408,7 @@ No changes will be made to system configuration.
c33036
             date=date,
c33036
             rand=rand
c33036
         )
c33036
-        return time.strftime(nstr)
c33036
+        return self.sanitize_filename(time.strftime(nstr))
c33036
 
c33036
     # for some specific binaries like "xz", we need to determine package
c33036
     # providing it; that is policy specific. By default return the binary
c33036
@@ -726,8 +726,8 @@ class LinuxPolicy(Policy):
c33036
         """Returns the name usd in the pre_work step"""
c33036
         return self.host_name()
c33036
 
c33036
-    def sanitize_case_id(self, case_id):
c33036
-        return re.sub(r"[^-a-z,A-Z.0-9]", "", case_id)
c33036
+    def sanitize_filename(self, name):
c33036
+        return re.sub(r"[^-a-z,A-Z.0-9]", "", name)
c33036
 
c33036
     def lsmod(self):
c33036
         """Return a list of kernel module names as strings.
c33036
@@ -755,9 +755,6 @@ class LinuxPolicy(Policy):
c33036
         if cmdline_opts.case_id:
c33036
             self.case_id = cmdline_opts.case_id
c33036
 
c33036
-        if self.case_id:
c33036
-            self.case_id = self.sanitize_case_id(self.case_id)
c33036
-
c33036
         return
c33036
 
c33036
 
c33036
-- 
c33036
2.17.1
c33036