diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2013-11-26 18:35:37 +0000 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2013-11-26 18:35:37 +0000 |
commit | 7649b791ee3372a660daad6e29666c2e1220486d (patch) | |
tree | 433639e43d307e12c846cc081ee535617e5b0a40 | |
parent | 84d553924175d3bd561140a8cc3e6685f6d05e73 (diff) | |
download | sos-7649b791ee3372a660daad6e29666c2e1220486d.tar.gz |
Log a warning when external commands time out
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/__init__.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index d5cabde9..dd2255cf 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -482,12 +482,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 @@ -562,9 +571,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: |