Blob Blame History Raw
From 2b46bf710ff266a5727f5c101872c778d470dcb4 Mon Sep 17 00:00:00 2001
From: Jan Jansky <jjansky@redhat.com>
Date: Wed, 15 Jul 2020 13:38:52 +0200
Subject: [PATCH] [gluster] remove only dump files

Removes only dump files and leaving
other files as .socket or sock.

Resolves: #2152

Signed-off-by: Jan Jansky <jjansky@redhat.com>
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
---
 sos/plugins/gluster.py | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/sos/plugins/gluster.py b/sos/plugins/gluster.py
index 9540d323..9815bbe7 100644
--- a/sos/plugins/gluster.py
+++ b/sos/plugins/gluster.py
@@ -40,15 +40,14 @@ class Gluster(Plugin, RedHatPlugin):
                 ret = string.count(last_line, 'DUMP_END_TIME')
 
     def postproc(self):
-        if not os.path.exists(self.statedump_dir):
-            return
-        try:
-            for dirs in os.listdir(self.statedump_dir):
-                os.remove(os.path.join(self.statedump_dir, dirs))
-            os.rmdir(self.statedump_dir)
-            os.unlink('/tmp/glusterdump.options')
-        except OSError:
-            pass
+        if self.get_option("dump"):
+            if not os.path.exists(self.statedump_dir):
+                return
+            try:
+                for name in glob.glob(self.statedump_dir + '/*.dump.[0-9]*'):
+                    os.remove(name)
+            except OSError:
+                pass
 
     def setup(self):
         self.add_forbidden_path("/var/lib/glusterd/geo-replication/secret.pem")
-- 
2.26.2

From 7994ea1cc22ae256f08426ef37931b7b58f0fefc Mon Sep 17 00:00:00 2001
From: Jan Jansky <jjansky@redhat.com>
Date: Thu, 16 Jul 2020 14:34:49 +0200
Subject: [PATCH] [gluster] remove generated state files

Remove also generated state files in
/run/gluster.

Resolves: #2154

Signed-off-by: Jan Jansky <jjansky@redhat.com>
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
---
 sos/plugins/gluster.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sos/plugins/gluster.py b/sos/plugins/gluster.py
index 9815bbe7..7b6a9298 100644
--- a/sos/plugins/gluster.py
+++ b/sos/plugins/gluster.py
@@ -45,7 +45,10 @@ class Gluster(Plugin, RedHatPlugin):
             if not os.path.exists(self.statedump_dir):
                 return
             try:
-                for name in glob.glob(self.statedump_dir + '/*.dump.[0-9]*'):
+                remove_files = glob.glob(self.statedump_dir + '/*.dump.[0-9]*')
+                remove_files.extend(glob.glob(self.statedump_dir +
+                                    '/glusterd_state_[0-9]*_[0-9]*'))
+                for name in remove_files:
                     os.remove(name)
             except OSError:
                 pass
-- 
2.26.2