diff options
author | Joel Andres Granados <jgranado@redhat.com> | 2008-08-08 17:23:51 +0200 |
---|---|---|
committer | Joel Andres Granados <jgranado@redhat.com> | 2008-08-08 17:58:51 +0200 |
commit | d2ac990fae74934887cba6a01ed5bb6d6c576422 (patch) | |
tree | 6f116352651fee9916fdf84f2792fe1e6ab7923d | |
parent | 90054c1550faaef35623979d23421b295262ffbf (diff) | |
download | firstaidkit-d2ac990fae74934887cba6a01ed5bb6d6c576422.tar.gz firstaidkit-d2ac990fae74934887cba6a01ed5bb6d6c576422.tar.xz firstaidkit-d2ac990fae74934887cba6a01ed5bb6d6c576422.zip |
Make the argument passing more general.
It is possible for the plugin name to have a space. when this
occured it threw off the argument detecting logic. This new
way of detecting the plugin name is more general.
-rwxr-xr-x | firstaidkit | 14 | ||||
-rw-r--r-- | pyfirstaidkit/plugins.py | 10 |
2 files changed, 12 insertions, 12 deletions
diff --git a/firstaidkit b/firstaidkit index 723c640..e25c1f7 100755 --- a/firstaidkit +++ b/firstaidkit @@ -16,7 +16,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -import sys, getopt, os, pprint, logging, re +import sys, getopt, os, pprint, logging, re, hashlib from threading import Thread from pyfirstaidkit import Tasker from pyfirstaidkit import Config @@ -228,15 +228,9 @@ if __name__=="__main__": Config.operation.dependencies = "False" elif key in ("--plugin-args"): - m = re.search("[^ ]* ", val) - if m: - plugin = m.group(0).strip() - args = val.strip("%s "%plugin) - if plugin and args: - if not Config.has_section("plugin-args"): - Config.add_section("plugin-args") - Config.set("plugin-args", plugin, args) - + if not Config.has_section("plugin-args"): + Config.add_section("plugin-args") + Config.set("plugin-args", hashlib.sha1(val).hexdigest(), val) if Flags.main_help: usage(sys.argv[0]) diff --git a/pyfirstaidkit/plugins.py b/pyfirstaidkit/plugins.py index e373322..3dda77c 100644 --- a/pyfirstaidkit/plugins.py +++ b/pyfirstaidkit/plugins.py @@ -27,6 +27,7 @@ import logging import imp import os +import re import subprocess from cStringIO import StringIO @@ -602,8 +603,13 @@ class PluginSystem(object): return False args = None - if Config.has_option("plugin-args", pklass.name): - args = Config.get("plugin-args", pklass.name) + if Config.has_section("plugin-args"): + for (name, value) in Config.items("plugin-args"): + # We see if the args line begins with any plugin name. + m = re.search("^%s"%plugin, value) + if m: + args = value.strip(plugin).strip(" ") + break infosection = getattr(Info, plugin) infosection.unlock() |