aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sos/report/__init__.py10
-rw-r--r--tests/report_tests/exception_tests.py13
2 files changed, 19 insertions, 4 deletions
diff --git a/sos/report/__init__.py b/sos/report/__init__.py
index 90ba2970..df99186d 100644
--- a/sos/report/__init__.py
+++ b/sos/report/__init__.py
@@ -651,7 +651,7 @@ class SoSReport(SoSComponent):
del opts[plugname]
for plugname in opts.keys():
self.soslog.error('WARNING: unable to set option for disabled '
- 'or non-existing plugin (%s)' % (plugname))
+ 'or non-existing plugin (%s).' % (plugname))
# in case we printed warnings above, visually intend them from
# subsequent header text
if opts.keys():
@@ -660,13 +660,17 @@ class SoSReport(SoSComponent):
def _check_for_unknown_plugins(self):
import itertools
for plugin in itertools.chain(self.opts.only_plugins,
- self.opts.skip_plugins,
self.opts.enable_plugins):
plugin_name = plugin.split(".")[0]
if plugin_name not in self.plugin_names:
self.soslog.fatal('a non-existing plugin (%s) was specified '
- 'in the command line' % (plugin_name))
+ 'in the command line.' % (plugin_name))
self._exit(1)
+ for plugin in self.opts.skip_plugins:
+ if plugin not in self.plugin_names:
+ self.soslog.warning(
+ "Requested to skip non-existing plugin '%s'." % plugin
+ )
def _set_plugin_options(self):
for plugin_name, plugin in self.loaded_plugins:
diff --git a/tests/report_tests/exception_tests.py b/tests/report_tests/exception_tests.py
index 652b9ebb..769954a0 100644
--- a/tests/report_tests/exception_tests.py
+++ b/tests/report_tests/exception_tests.py
@@ -6,7 +6,7 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos_tests import StageOneReportExceptionTest
+from sos_tests import StageOneReportExceptionTest, StageOneReportTest
class InvalidPluginEnabledTest(StageOneReportExceptionTest):
@@ -41,3 +41,14 @@ class InvalidReportOptionTest(StageOneReportExceptionTest):
def test_caught_invalid_option(self):
self.assertOutputContains('unrecognized arguments\: --magic')
+
+class InvalidPluginDisableTest(StageOneReportTest):
+ """Ensure passing an invalid plugin name for skipping does not stop the
+ execution, see PR#2517
+
+ :avocado: tags=stageone
+ """
+ sos_cmd = '-n logs,foobar,networking'
+
+ def test_caught_invalid_plugin_name(self):
+ self.assertOutputContains("Requested to skip non-existing plugin 'foobar'")