diff options
author | Jan Jansky <jjansky@redhat.com> | 2020-07-15 13:38:52 +0200 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2020-07-15 10:22:04 -0400 |
commit | 2b46bf710ff266a5727f5c101872c778d470dcb4 (patch) | |
tree | 66219190f1ca84627faef1a3cfde3efd97b4df71 | |
parent | 6818b5481475e582900a8ed2a776bd7b3c77c28d (diff) | |
download | sos-2b46bf710ff266a5727f5c101872c778d470dcb4.tar.gz |
[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>
-rw-r--r-- | sos/report/plugins/gluster.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/sos/report/plugins/gluster.py b/sos/report/plugins/gluster.py index 9540d323..9815bbe7 100644 --- a/sos/report/plugins/gluster.py +++ b/sos/report/plugins/gluster.py @@ -41,15 +41,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") |