summaryrefslogtreecommitdiffstats
path: root/pyfirstaidkit
diff options
context:
space:
mode:
authorJoel Andres Granados <jgranado@redhat.com>2008-03-14 12:01:28 +0100
committerJoel Andres Granados <jgranado@redhat.com>2008-03-14 12:01:28 +0100
commit72b692959cb567d01ee376ef248d98004727808f (patch)
tree53f4abe2473fffbcbe597c72916f4f7f13867ed8 /pyfirstaidkit
parent9336abca3dea390727c32f8b4cc53aad4dfb94ef (diff)
Create an use the invalidpluginname exception.
Diffstat (limited to 'pyfirstaidkit')
-rw-r--r--pyfirstaidkit/errors.py6
-rw-r--r--pyfirstaidkit/interpret.py5
-rw-r--r--pyfirstaidkit/plugins.py10
3 files changed, 19 insertions, 2 deletions
diff --git a/pyfirstaidkit/errors.py b/pyfirstaidkit/errors.py
index b967bc9..31f1739 100644
--- a/pyfirstaidkit/errors.py
+++ b/pyfirstaidkit/errors.py
@@ -27,3 +27,9 @@ class InvalidFlowNameException(Exception):
self.message="There are no flows by the name of %s" % name
def __str__(self):
return self.message
+
+class InvalidPluginNameException(Exception):
+ def __init__(self, name):
+ self.message="There are no flows by the name of %s" % name
+ def __str__(self):
+ return self.message
diff --git a/pyfirstaidkit/interpret.py b/pyfirstaidkit/interpret.py
index f7a8df7..713586e 100644
--- a/pyfirstaidkit/interpret.py
+++ b/pyfirstaidkit/interpret.py
@@ -120,7 +120,10 @@ class Tasker:
except InvalidFlowNameException, e:
pass
elif self._config.operation.mode == "plugin":
- pluginSystem.autorun(self._config.operation.plugin, dependencies = False)
+ try:
+ pluginSystem.autorun(self._config.operation.plugin, dependencies = False)
+ except InvalidPluginNameException, e:
+ pass
elif self._config.operation.mode == "task":
pass
elif self._config.operation.mode == "list":
diff --git a/pyfirstaidkit/plugins.py b/pyfirstaidkit/plugins.py
index ecad3c4..7d6080f 100644
--- a/pyfirstaidkit/plugins.py
+++ b/pyfirstaidkit/plugins.py
@@ -408,7 +408,14 @@ class PluginSystem(object):
self._reporting.start(level = PLUGIN, origin = self, message = plugin)
- pklass = self._plugins[plugin].get_plugin() #get top level class of plugin
+ if plugin in self._plugins.keys():
+ pklass = self._plugins[plugin].get_plugin() #get top level class of plugin
+ else:
+ self._reporting.exception(message = "Plugin %s was not detected" % plugin,
+ level = PLUGINSYSTEM, origin = self)
+ self._reporting.stop(level = PLUGIN, origin = self, message = plugin)
+ raise InvalidPluginNameException(plugin)
+
plugindir = os.path.dirname(self._plugins[plugin].__file__)
Logger.info("Plugin information...")
Logger.info("name:%s , version:%s , author:%s " % pklass.info())
@@ -424,6 +431,7 @@ class PluginSystem(object):
if flowName not in flows:
self._reporting.exception(message = "Flow %s does not exist in plugin %s" %
(flowName, plugin), level = PLUGINSYSTEM, origin = self)
+ self._reporting.stop(level = PLUGIN, origin = self, message = plugin)
raise InvalidFlowNameException(flowName)
if dependencies: