X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Fcmd%2Fcli.py;h=0bc7c1617763a5e4658eb73f9a0e659ebc30044f;hb=78939bfbd95b7047f00e234b03e478255ed6ece5;hp=6281bb81360f370dd444576ad2a9f207735ec6e8;hpb=61c9612197d9a204cc7efa0a324a2b136886506f;p=yardstick.git diff --git a/yardstick/cmd/cli.py b/yardstick/cmd/cli.py index 6281bb813..0bc7c1617 100644 --- a/yardstick/cmd/cli.py +++ b/yardstick/cmd/cli.py @@ -20,24 +20,23 @@ from pkg_resources import get_distribution from argparse import RawDescriptionHelpFormatter from oslo_config import cfg -from yardstick import _init_logging, LOG +from yardstick import _init_logging, _LOG_STREAM_HDLR from yardstick.cmd.commands import task from yardstick.cmd.commands import runner from yardstick.cmd.commands import scenario from yardstick.cmd.commands import testcase from yardstick.cmd.commands import plugin from yardstick.cmd.commands import env +from yardstick.cmd.commands import report +from yardstick.common import import_tools + CONF = cfg.CONF cli_opts = [ cfg.BoolOpt('debug', short='d', default=False, - help='increase output verbosity to debug'), - cfg.BoolOpt('verbose', - short='v', - default=False, - help='increase output verbosity to info') + help='increase output verbosity to debug') ] CONF.register_cli_opts(cli_opts) @@ -56,7 +55,8 @@ def find_config_files(path_list): return None -class YardstickCLI(): +@import_tools.decorator_banned_modules +class YardstickCLI(object): # pragma: no cover """Command-line interface to yardstick""" # Command categories @@ -66,7 +66,8 @@ class YardstickCLI(): 'scenario': scenario.ScenarioCommands, 'testcase': testcase.TestcaseCommands, 'plugin': plugin.PluginCommands, - 'env': env.EnvCommand + 'env': env.EnvCommand, + 'report': report.ReportCommands } def __init__(self): @@ -110,7 +111,7 @@ class YardstickCLI(): # register subcommands to parse additional command line arguments def parser(subparsers): - self._add_command_parsers(YardstickCLI.categories, subparsers) + self._add_command_parsers(self.categories, subparsers) category_opt = cfg.SubCommandOpt("category", title="Command categories", @@ -132,19 +133,16 @@ class YardstickCLI(): def _handle_global_opts(self): _init_logging() - if CONF.verbose: - LOG.setLevel(logging.INFO) - if CONF.debug: - LOG.setLevel(logging.DEBUG) + _LOG_STREAM_HDLR.setLevel(logging.DEBUG) - def _dispath_func_notask(self): + def _dispatch_func_notask(self): # dispatch to category parser func = CONF.category.func func(CONF.category) - def _dispath_func_task(self, task_id): + def _dispatch_func_task(self, task_id): # dispatch to category parser func = CONF.category.func @@ -164,7 +162,7 @@ class YardstickCLI(): self._handle_global_opts() - self._dispath_func_notask() + self._dispatch_func_notask() finally: self._clear_config_opts() @@ -177,6 +175,6 @@ class YardstickCLI(): self._handle_global_opts() - self._dispath_func_task(task_id) + self._dispatch_func_task(task_id) finally: self._clear_config_opts()