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