From 65c47f29b469f4b622dea4f01bbc3931fce8450f Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Wed, 2 Jul 2014 20:34:27 +0100 Subject: [plugin] log directory contents added via Plugin.copy_dir() We're currently very verbose about the copyspecs and path lists we process during setup() and collect() but right now we do not log the same level of information for artefacts that are included in the archive as a consequence of Plugin.do_copy_path() calling copy_dir() on the result of copyspec expansion. Log these explicitly and promote logging of copyspec expansion to match that used for command logging. This makes us very chatty at high verbosity but allows a clean view of exactly what the tree walking code is doing (which my sanity desperately needs). Signed-off-by: Bryn M. Reeves --- sos/plugins/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index 63a65a68..eac78153 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -264,6 +264,7 @@ class Plugin(object): def copy_dir(self, srcpath): for afile in os.listdir(srcpath): + self.log_debug("recursively adding '%s' from '%s'" % (afile, srcpath)) self.do_copy_path(os.path.join(srcpath, afile), dest=None) def _get_dest_for_srcpath(self, srcpath): @@ -304,12 +305,13 @@ class Plugin(object): self.copy_dir(srcpath) return + # filter out device nodes if stat.S_ISBLK(st.st_mode) or stat.S_ISCHR(st.st_mode): devtype = "block" if stat.S_ISBLK(stat.st_mode) else "character" self.log_debug("skipping %s device node %s" % (devtype, srcpath)) # if we get here, it's definitely a regular file (not a symlink or dir) - self.log_debug("copying file '%s' to archive:'%s'" % (srcpath,dest)) + self.log_debug("copying path '%s' to archive:'%s'" % (srcpath,dest)) # if not readable(srcpath) if not (st.st_mode & 0o444): @@ -437,7 +439,7 @@ class Plugin(object): return False copy_paths = self.expand_copy_spec(copyspec) self.copy_paths.update(copy_paths) - self.log_debug("added copyspec '%s'" % copyspec) + self.log_info("added copyspec '%s'" % copyspec) def get_command_output(self, prog, timeout=300, runat=None): result = sos_get_command_output(prog, timeout=timeout, runat=runat) -- cgit