aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sos/plugins/__init__.py5
-rw-r--r--sos/policies/__init__.py6
-rw-r--r--sos/sosreport.py25
3 files changed, 31 insertions, 5 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index 9d126a51..4ddd185d 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -760,6 +760,11 @@ class IndependentPlugin(object):
pass
+class ExperimentalPlugin(object):
+ """Tagging class that indicates that this plugin is experimental"""
+ pass
+
+
def import_plugin(name, superclasses=None):
"""Import name as a module and return a list of all classes defined in that
module. superclasses should be a tuple of valid superclasses to import,
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py
index 4c42d024..b3f06230 100644
--- a/sos/policies/__init__.py
+++ b/sos/policies/__init__.py
@@ -12,7 +12,7 @@ from sos.utilities import (ImporterHelper,
import_module,
get_hash_name,
shell_out)
-from sos.plugins import IndependentPlugin
+from sos.plugins import IndependentPlugin, ExperimentalPlugin
from sos import _sos as _
import hashlib
from textwrap import fill
@@ -219,11 +219,13 @@ No changes will be made to system configuration.
return p
return plugin_classes[0]
- def validate_plugin(self, plugin_class):
+ def validate_plugin(self, plugin_class, experimental=False):
"""
Verifies that the plugin_class should execute under this policy
"""
valid_subclasses = [IndependentPlugin] + self.valid_subclasses
+ if experimental:
+ valid_subclasses += [ExperimentalPlugin]
return any(issubclass(plugin_class, class_) for
class_ in valid_subclasses)
diff --git a/sos/sosreport.py b/sos/sosreport.py
index 2af9907e..5711ab69 100644
--- a/sos/sosreport.py
+++ b/sos/sosreport.py
@@ -287,6 +287,16 @@ class SoSOptions(object):
self._noplugins = value
@property
+ def experimental(self):
+ if self._options is not None:
+ return self._options.experimental
+
+ @experimental.setter
+ def experimental(self, value):
+ self._check_options_initialized()
+ self._experimental = value
+
+ @property
def enableplugins(self):
if self._options is not None:
return self._options.enableplugins
@@ -539,6 +549,9 @@ class SoSOptions(object):
parser.add_option("-n", "--skip-plugins", action="extend",
dest="noplugins", type="string",
help="disable these plugins", default=deque())
+ parser.add_option("--experimental", action="store_true",
+ dest="experimental", default=False,
+ help="enable experimental plugins")
parser.add_option("-e", "--enable-plugins", action="extend",
dest="enableplugins", type="string",
help="enable these plugins", default=deque())
@@ -850,18 +863,24 @@ class SoSReport(object):
self.plugin_names = deque()
self.profiles = set()
using_profiles = len(self.opts.profiles)
+ policy_classes = self.policy.valid_subclasses
+ extra_classes = []
+ if self.opts.experimental:
+ extra_classes.append(sos.plugins.ExperimentalPlugin)
+ valid_plugin_classes = tuple(policy_classes + extra_classes)
+ validate_plugin = self.policy.validate_plugin
# validate and load plugins
for plug in plugins:
plugbase, ext = os.path.splitext(plug)
try:
- plugin_classes = import_plugin(
- plugbase, tuple(self.policy.valid_subclasses))
+ plugin_classes = import_plugin(plugbase, valid_plugin_classes)
if not len(plugin_classes):
# no valid plugin classes for this policy
continue
plugin_class = self.policy.match_plugin(plugin_classes)
- if not self.policy.validate_plugin(plugin_class):
+ if not validate_plugin(plugin_class,
+ experimental=self.opts.experimental):
self.soslog.warning(
_("plugin %s does not validate, skipping") % plug)
if self.opts.verbosity > 0: