Blob Blame History Raw
From a36c892e7a60ef5bba03e07c12ef1939fd2f0a45 Mon Sep 17 00:00:00 2001
From: Pavel Moravec <pmoravec@redhat.com>
Date: Wed, 2 Oct 2019 16:55:05 +0200
Subject: [PATCH] [gluster] process files only from a statedump dir

Traversing statedump dir for statedump files must skip
subdirectories (where the dump files won't appear).

Resolves: #1812

Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
---
 sos/plugins/gluster.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sos/plugins/gluster.py b/sos/plugins/gluster.py
index 101b0da2..ae770f07 100644
--- a/sos/plugins/gluster.py
+++ b/sos/plugins/gluster.py
@@ -42,7 +42,9 @@ class Gluster(Plugin, RedHatPlugin):
 
     def wait_for_statedump(self, name_dir):
         statedumps_present = 0
-        statedump_entries = os.listdir(name_dir)
+        statedump_entries = [
+                f for f in os.listdir(name_dir) if os.path.isfile(f)
+        ]
         for statedump_file in statedump_entries:
             statedumps_present = statedumps_present+1
             ret = -1
-- 
2.21.0