diff options
author | shnavid <shnavid@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2007-07-02 11:01:49 +0000 |
---|---|---|
committer | shnavid <shnavid@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2007-07-02 11:01:49 +0000 |
commit | 96e5f9dab0596952f916f958b79a07d59135f078 (patch) | |
tree | 320acb3bc7d9aad26bbcd38a9b9d6c9557db4fac /src | |
parent | f72f6a16c49087507df6f25d085a5e52e44852de (diff) | |
download | sos-96e5f9dab0596952f916f958b79a07d59135f078.tar.gz |
* Added command line option to set plugin options (ie. to enable "rpm -Va": sosreport -k rpm.rpmva)
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@152 ef72aa8b-4018-0410-8976-d6e080ef94d8
Diffstat (limited to 'src')
-rwxr-xr-x | src/sosreport | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/sosreport b/src/sosreport index a8090a5d..aa4e193e 100755 --- a/src/sosreport +++ b/src/sosreport @@ -115,6 +115,9 @@ __cmdParser__.add_option("-n", "--noplugin", action="extend", \ __cmdParser__.add_option("-o", "--onlyplugin", action="extend", \ dest="onlyplugins", type="string", \ help="list of plugins to load") +__cmdParser__.add_option("-k", "--pluginopts", action="extend", \ + dest="plugopts", type="string", \ + help="plugin options in plugin_name.option=value format") __cmdParser__.add_option("-v", "--verbose", action="count", \ dest="verbosity", \ help="How obnoxious we're being about telling the user what we're doing.") @@ -427,7 +430,20 @@ def sosreport(): for optname, optparm in zip(names, parms): alloptions.append((plug, plugname, optname, optparm)) - if not __cmdLineOpts__.fastoptions and not __cmdLineOpts__.usealloptions: + if __cmdLineOpts__.plugopts: + opts = {} + for opt in __cmdLineOpts__.plugopts: + try: opt, val = opt.split("=") + except: val=1 + plug, opt = opt.split(".") + try: opts[plug] + except KeyError: opts[plug] = [] + opts[plug].append( (opt,val) ) + for plugname, plug in loadedplugins: + if opts.has_key(plugname): + for opt,val in opts[plugname]: + plug.setOption(opt,val) + elif not __cmdLineOpts__.fastoptions and not __cmdLineOpts__.usealloptions: if len(alloptions): try: get_curse_options(alloptions) |