commit b4c768e38289e2cd85d09a1f465b233ba676b281 Author: Bryn M. Reeves Date: Tue Nov 26 18:35:37 2013 +0000 Log a warning when external commands time out Signed-off-by: Bryn M. Reeves diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index e25f035..b86351f 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -476,12 +476,21 @@ class Plugin(object): if filespec not in self.copy_paths: self.copy_paths.append((filespec, sub)) + def get_command_output(self, prog, timeout=300): + (status, output, runtime) = sos_get_command_output(prog, timeout) + if status == 124: + self.soslog.warning("command %s timed out after %ds" + % (prog, timeout)) + if status == 127: + self.soslog.warning("could not run '%s': command not found" % prog) + return (status, output, runtime) + def call_ext_prog(self, prog, timeout=300): """Execute a command independantly of the output gathering part of sosreport. """ # pylint: disable-msg = W0612 - return sos_get_command_output(prog, timeout) + return self.get_command_output(prog, timeout) def check_ext_prog(self, prog): """Execute a command independently of the output gathering part of @@ -541,9 +550,8 @@ class Plugin(object): start_time = time() # pylint: disable-msg = W0612 - status, shout, runtime = sos_get_command_output(exe, timeout=timeout) + status, shout, runtime = self.get_command_output(exe, timeout=timeout) if (status == 127): - self.soslog.debug("could not run '%s': command not found" % exe) return None if suggest_filename: commit 4787ffa73970048eacc576081d4e35671d0fc408 Author: Bryn M. Reeves Date: Tue Nov 26 18:39:43 2013 +0000 Make command quoting in log messages consistent The last commit adds a log message for commands that time out but is inconsistent with other messages that include an external command string. Quote the command for better readability. Signed-off-by: Bryn M. Reeves diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index b86351f..681299a 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -479,7 +479,7 @@ class Plugin(object): def get_command_output(self, prog, timeout=300): (status, output, runtime) = sos_get_command_output(prog, timeout) if status == 124: - self.soslog.warning("command %s timed out after %ds" + self.soslog.warning("command '%s' timed out after %ds" % (prog, timeout)) if status == 127: self.soslog.warning("could not run '%s': command not found" % prog)