aboutsummaryrefslogtreecommitdiffstats
path: root/src/sosreport
diff options
context:
space:
mode:
authorshnavid <shnavid@ef72aa8b-4018-0410-8976-d6e080ef94d8>2007-03-07 15:33:06 +0000
committershnavid <shnavid@ef72aa8b-4018-0410-8976-d6e080ef94d8>2007-03-07 15:33:06 +0000
commitdc136d89fb6b68bbf8bd7106c715452c7203ab73 (patch)
tree87890f1534b729eb5491baa55439436db7660a49 /src/sosreport
parentf9dfbdf7476362e1aaf755e8563434e37167407d (diff)
downloadsos-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-xsrc/sosreport21
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", \