diff options
author | shnavid <shnavid@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2007-03-07 15:33:06 +0000 |
---|---|---|
committer | shnavid <shnavid@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2007-03-07 15:33:06 +0000 |
commit | dc136d89fb6b68bbf8bd7106c715452c7203ab73 (patch) | |
tree | 87890f1534b729eb5491baa55439436db7660a49 /src/sosreport | |
parent | f9dfbdf7476362e1aaf755e8563434e37167407d (diff) | |
download | sos-dc136d89fb6b68bbf8bd7106c715452c7203ab73.tar.gz |
Allow passing multiple comma-separated plugin names to -n (--noplugin) and -o (--onlyplugin) options.
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@90 ef72aa8b-4018-0410-8976-d6e080ef94d8
Diffstat (limited to 'src/sosreport')
-rwxr-xr-x | src/sosreport | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/sosreport b/src/sosreport index 63f0648d..3989ff0b 100755 --- a/src/sosreport +++ b/src/sosreport @@ -28,7 +28,7 @@ supplied for application-specific information import sys import os #import curses -from optparse import OptionParser +from optparse import OptionParser, Option import sos.policyredhat from sos.helpers import * from snack import * @@ -78,8 +78,21 @@ if os.getuid() != 0: # for debugging __raisePlugins__ = 1 +class SosOption (Option): + """Allow to specify comma delimited list of plugins""" + ACTIONS = Option.ACTIONS + ("extend",) + STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",) + TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extend",) + ALWAYS_TYPED_ACTIONS = Option.ALWAYS_TYPED_ACTIONS + ("extend",) + + def take_action(self, action, dest, opt, value, values, parser): + if action == "extend": + lvalue = value.split(",") + values.ensure_value(dest, []).extend(lvalue) + else: + Option.take_action(self, action, dest, opt, value, values, parser) -__cmdParser__ = OptionParser() +__cmdParser__ = OptionParser(option_class=SosOption) __cmdParser__.add_option("-a", "--alloptions", action="store_true", \ dest="usealloptions", default=False, \ help="Use all options for loaded plugins") @@ -92,10 +105,10 @@ __cmdParser__.add_option("-g", "--gatheronly", action="store_true", \ __cmdParser__.add_option("-l", "--list-plugins", action="store_true", \ dest="listPlugins", default=False, \ help="list existing plugins") -__cmdParser__.add_option("-n", "--noplugin", action="append", \ +__cmdParser__.add_option("-n", "--noplugin", action="extend", \ dest="noplugins",\ help="list of plugins _not_ to load") -__cmdParser__.add_option("-o", "--onlyplugin", action="append", \ +__cmdParser__.add_option("-o", "--onlyplugin", action="extend", \ dest="onlyplugins",\ help="list of plugins to load") __cmdParser__.add_option("-v", "--verbose", action="count", \ |