summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Andres Granados <jgranado@redhat.com>2008-07-15 22:22:38 +0200
committerJoel Andres Granados <jgranado@redhat.com>2008-07-15 22:22:38 +0200
commit6551c3c0f3eda6397c07edc0e8b0dc8643bd2e8d (patch)
tree91dd25e419017550e97344b6222666c6a1e89d94
parent8bf3408b2ec2b39dd27df68291ae832d96f4484e (diff)
downloadfirstaidkit-6551c3c0f3eda6397c07edc0e8b0dc8643bd2e8d.tar.gz
firstaidkit-6551c3c0f3eda6397c07edc0e8b0dc8643bd2e8d.tar.xz
firstaidkit-6551c3c0f3eda6397c07edc0e8b0dc8643bd2e8d.zip
Catch the exception where the user configures a plugin that is not found.
-rwxr-xr-xfirstaidkit3
-rw-r--r--pyfirstaidkit/errors.py2
-rw-r--r--pyfirstaidkit/plugins.py6
3 files changed, 8 insertions, 3 deletions
diff --git a/firstaidkit b/firstaidkit
index cb37600..a32c3ea 100755
--- a/firstaidkit
+++ b/firstaidkit
@@ -22,6 +22,7 @@ from pyfirstaidkit import Tasker
from pyfirstaidkit import Config
from pyfirstaidkit import reporting
from pyfirstaidkit import initLogger
+from pyfirstaidkit.errors import InvalidPluginNameException
from pyfirstaidkit.utils import BackupException
class Flags:
@@ -332,6 +333,8 @@ if __name__=="__main__":
try:
singlerun.run()
+ except InvalidPluginNameException, ipne:
+ print(ipne)
except Exception, e:
print("!!! Impossible happened!! The First Aid Kit crashed in "
"very unsafe way.\n!!! Please report this to the authors "
diff --git a/pyfirstaidkit/errors.py b/pyfirstaidkit/errors.py
index 04a396e..2c91d2e 100644
--- a/pyfirstaidkit/errors.py
+++ b/pyfirstaidkit/errors.py
@@ -31,7 +31,7 @@ class InvalidFlowNameException(Exception):
class InvalidPluginNameException(Exception):
def __init__(self, name):
- self.message="There are no flows by the name of %s" % name
+ self.message="No flows by the name of \"%s\" where found." % name
def __str__(self):
return self.message
diff --git a/pyfirstaidkit/plugins.py b/pyfirstaidkit/plugins.py
index acccf6e..87d5994 100644
--- a/pyfirstaidkit/plugins.py
+++ b/pyfirstaidkit/plugins.py
@@ -614,5 +614,7 @@ class PluginSystem(object):
def getplugin(self, plugin):
"""Get top level class of plugin, so we can create the instance and
call the steps manually"""
- return self._plugins[plugin].get_plugin()
-
+ if plugin in self._plugins:
+ return self._plugins[plugin].get_plugin()
+ else:
+ raise InvalidPluginNameException(plugin)