diff options
author | Joel Andres Granados <jgranado@redhat.com> | 2008-08-08 10:59:04 +0200 |
---|---|---|
committer | Joel Andres Granados <jgranado@redhat.com> | 2008-08-08 11:29:34 +0200 |
commit | 5a0ae1c50be8e9f39478b688da175083cb4ef9f4 (patch) | |
tree | c44db7dcb7f1e08821db1f6bef17923791530bb2 /pyfirstaidkit | |
parent | 51a175634d24eec42ad5a7cbe23660b42a63470c (diff) | |
download | firstaidkit-5a0ae1c50be8e9f39478b688da175083cb4ef9f4.tar.gz firstaidkit-5a0ae1c50be8e9f39478b688da175083cb4ef9f4.tar.xz firstaidkit-5a0ae1c50be8e9f39478b688da175083cb4ef9f4.zip |
Add the possibility to pass arguments to plugins.
Given that firstaidkit is fully automated we need a way to modify the
plugin behaviour from the initial command. This makes it easy for the
plugin developer to get a string with some arguments for his plugin.
It is up to the plugin developer to parse the string.
The arguments will be accessible through self._args variable.
Diffstat (limited to 'pyfirstaidkit')
-rw-r--r-- | pyfirstaidkit/plugins.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/pyfirstaidkit/plugins.py b/pyfirstaidkit/plugins.py index 82d7049..e373322 100644 --- a/pyfirstaidkit/plugins.py +++ b/pyfirstaidkit/plugins.py @@ -110,7 +110,7 @@ class Plugin(object): default_flow = "diagnose" def __init__(self, flow, reporting, dependencies, path = None, - backups = None, info = None): + backups = None, info = None, args = None): """ Initialize the instance. flow -- Name of the flow to be used with this instance. @@ -127,6 +127,7 @@ class Plugin(object): self._path = path self._backups = backups self._info = info + self._args = args self.provide = dependencies.provide self.unprovide = dependencies.unprovide @@ -600,11 +601,15 @@ class PluginSystem(object): message = plugin) return False + args = None + if Config.has_option("plugin-args", pklass.name): + args = Config.get("plugin-args", pklass.name) + infosection = getattr(Info, plugin) infosection.unlock() p = pklass(flowName, reporting = self._reporting, dependencies = self._deps, backups = self._backups, - path = plugindir, info = infosection) + path = plugindir, info = infosection, args = args) for (step, rv) in p: #autorun all the needed steps Logger.info("Running step %s in plugin %s ...", step, plugin) Logger.info("%s is current step and %s is result of that step." % |