summaryrefslogtreecommitdiffstats
path: root/rteval-cmd
diff options
context:
space:
mode:
authorDavid Sommerseth <davids@redhat.com>2012-12-18 22:27:51 +0100
committerDavid Sommerseth <davids@redhat.com>2012-12-18 22:27:51 +0100
commitfa6ff23d9c10e8f94b0d9ed85f4723f4646d0ad3 (patch)
treee9d158718812fa322932c5500bea14a77314955e /rteval-cmd
parentd3976bd04b251dfdb6a2823326acbdfbfa57c1e6 (diff)
downloadrteval-fa6ff23d9c10e8f94b0d9ed85f4723f4646d0ad3.tar.gz
rteval-fa6ff23d9c10e8f94b0d9ed85f4723f4646d0ad3.tar.xz
rteval-fa6ff23d9c10e8f94b0d9ed85f4723f4646d0ad3.zip
Added infrastructure to add command line arguments from modules
All rteval modules must now provide a ModuleParameters() function which returns a dictionary containing the option setup it expects. Each module will get a separate option group, and all its options will be prefixed with the module name. These option variables will be stored as well, prefixed with the module name. So if the a module 'dummy' configures an option 'value1', it will be stored as 'dummy_value1' in the option container. To set this option, you will need to use --dummy-value1 from the command line. Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to 'rteval-cmd')
-rwxr-xr-xrteval-cmd9
1 files changed, 6 insertions, 3 deletions
diff --git a/rteval-cmd b/rteval-cmd
index 8d1e30d..b886781 100755
--- a/rteval-cmd
+++ b/rteval-cmd
@@ -95,11 +95,10 @@ def summarize(repfile, xslt):
-def parse_options(cfg, cmdargs):
+def parse_options(cfg, parser, cmdargs):
'''parse the command line arguments'''
rtevcfg = cfg.GetSection('rteval')
- parser = optparse.OptionParser()
parser.add_option("-d", "--duration", dest="duration",
type="string", default=rtevcfg.duration,
help="specify length of test run (default: %default)")
@@ -162,6 +161,7 @@ def parse_options(cfg, cmdargs):
v = v[:-1]
mult = 3600.0 * 24.0
cmd_opts.duration = float(v) * mult
+
return (cmd_opts, cmd_args)
@@ -235,7 +235,10 @@ if __name__ == '__main__':
measuremods = MeasurementModules(config, logger=logger)
# parse command line options
- (cmd_opts, cmd_args) = parse_options(config, sys.argv[1:])
+ parser = optparse.OptionParser()
+ loadmods.SetupModuleOptions(parser)
+ measuremods.SetupModuleOptions(parser)
+ (cmd_opts, cmd_args) = parse_options(config, parser, sys.argv[1:])
# copy the command line options into the rteval config section
# (cmd line overrides config file values)