aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sos/report/__init__.py14
-rw-r--r--sos/report/plugins/__init__.py17
-rw-r--r--sos/utilities.py4
3 files changed, 21 insertions, 14 deletions
diff --git a/sos/report/__init__.py b/sos/report/__init__.py
index 4e9e5fcb..16213c0a 100644
--- a/sos/report/__init__.py
+++ b/sos/report/__init__.py
@@ -18,7 +18,7 @@ from datetime import datetime
import glob
import sos.report.plugins
from sos.utilities import (ImporterHelper, SoSTimeoutError,
- sos_get_command_output)
+ sos_get_command_output, TIMEOUT_DEFAULT)
from shutil import rmtree
import hashlib
from concurrent.futures import ThreadPoolExecutor, TimeoutError
@@ -108,8 +108,8 @@ class SoSReport(SoSComponent):
'note': '',
'only_plugins': [],
'preset': 'auto',
- 'plugin_timeout': 300,
- 'cmd_timeout': 300,
+ 'plugin_timeout': TIMEOUT_DEFAULT,
+ 'cmd_timeout': TIMEOUT_DEFAULT,
'profiles': [],
'since': None,
'verify': False,
@@ -733,7 +733,10 @@ class SoSReport(SoSComponent):
self.ui_log.info(_("The following options are available for ALL "
"plugins:"))
for opt in self.all_options[0][0]._default_plug_opts:
- self.ui_log.info(" %-25s %-15s %s" % (opt[0], opt[3], opt[1]))
+ val = opt[3]
+ if val == -1:
+ val = TIMEOUT_DEFAULT
+ self.ui_log.info(" %-25s %-15s %s" % (opt[0], val, opt[1]))
self.ui_log.info("")
self.ui_log.info(_("The following plugin options are available:"))
@@ -749,6 +752,9 @@ class SoSReport(SoSComponent):
else:
tmpopt = optparm["enabled"]
+ if tmpopt is None:
+ tmpopt = 0
+
self.ui_log.info(" %-25s %-15s %s" % (
plugname + "." + optname, tmpopt, optparm["desc"]))
else:
diff --git a/sos/report/plugins/__init__.py b/sos/report/plugins/__init__.py
index d851ef3e..549a70ef 100644
--- a/sos/report/plugins/__init__.py
+++ b/sos/report/plugins/__init__.py
@@ -11,8 +11,10 @@
""" This exports methods available for use by plugins for sos """
from sos.utilities import (sos_get_command_output, import_module, grep,
- fileobj, tail, is_executable, path_exists,
- path_isdir, path_isfile, path_islink, listdir)
+ fileobj, tail, is_executable, TIMEOUT_DEFAULT,
+ path_exists, path_isdir, path_isfile, path_islink,
+ listdir)
+
import os
import glob
import re
@@ -462,8 +464,8 @@ class Plugin(object):
archive = None
profiles = ()
sysroot = '/'
- plugin_timeout = 300
- cmd_timeout = 300
+ plugin_timeout = TIMEOUT_DEFAULT
+ cmd_timeout = TIMEOUT_DEFAULT
_timeout_hit = False
cmdtags = {}
filetags = {}
@@ -473,11 +475,8 @@ class Plugin(object):
predicate = None
cmd_predicate = None
_default_plug_opts = [
- ('timeout', 'Timeout in seconds for plugin. The default value (-1) ' +
- 'defers to the general plugin timeout, 300 seconds', 'fast', -1),
- ('cmd-timeout', 'Timeout in seconds for a command execution. The ' +
- 'default value (-1) defers to the general cmd timeout, 300 ' +
- 'seconds', 'fast', -1),
+ ('timeout', 'Timeout in seconds for plugin to finish', 'fast', -1),
+ ('cmd-timeout', 'Timeout in seconds for a command', 'fast', -1),
('postproc', 'Enable post-processing collected plugin data', 'fast',
True)
]
diff --git a/sos/utilities.py b/sos/utilities.py
index 95df19cb..c940e066 100644
--- a/sos/utilities.py
+++ b/sos/utilities.py
@@ -23,6 +23,8 @@ import io
from contextlib import closing
from collections import deque
+TIMEOUT_DEFAULT = 300
+
def tail(filename, number_of_bytes):
"""Returns the last number_of_bytes of filename"""
@@ -102,7 +104,7 @@ def is_executable(command):
return any(os.access(path, os.X_OK) for path in candidates)
-def sos_get_command_output(command, timeout=300, stderr=False,
+def sos_get_command_output(command, timeout=TIMEOUT_DEFAULT, stderr=False,
chroot=None, chdir=None, env=None, foreground=False,
binary=False, sizelimit=None, poller=None):
"""Execute a command and return a dictionary of status and output,