aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKamalesh Babulal <kamalesh@linux.ibm.com>2019-10-03 18:54:49 +0530
committerBryn M. Reeves <bmr@redhat.com>2019-10-08 15:25:37 +0100
commit4830d4a6937e17217a6391b553c1c8d0addfbc27 (patch)
treef19c51ecc2becb74ad81c575680f4c935ad61bb6
parent65f706719ddc7d43dde33d5d517409725b0fa6a4 (diff)
downloadsos-4830d4a6937e17217a6391b553c1c8d0addfbc27.tar.gz
[Plugin] Copy empty directories _do_copy_paths
Empty directories too provide some valid and helpful information in the path copied, for example, Kernel livepatching subsystem exports the functions being livepatched as empty directories instead of a file. Similarly disable directory of apparmor, which indicates the status of the profile. The current code copies a directory to the archive only if it contains files and skips in the case of an empty directory. This patch, copies such skipped directory too. Signed-off-by: Kamalesh Babulal <kamalesh@linux.ibm.com>
-rw-r--r--sos/plugins/__init__.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index 713c7278..fda8fa29 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -734,6 +734,10 @@ class Plugin(object):
return
else:
if stat.S_ISDIR(st.st_mode) and os.access(srcpath, os.R_OK):
+ # copy empty directory
+ if not os.listdir(srcpath):
+ self.archive.add_dir(srcpath)
+ return
self._copy_dir(srcpath)
return