diff options
author | chenjiankun <chenjiankun1@huawei.com> | 2016-12-02 12:36:56 +0000 |
---|---|---|
committer | chenjiankun <chenjiankun1@huawei.com> | 2016-12-02 12:36:56 +0000 |
commit | 81a84601d1ecb5312e4e3904167f2a2e60365f2a (patch) | |
tree | 248fc60cd5705faa97f7a3d6cebbe916e4f60ccc | |
parent | dfe01b8db0d51bcaaa6c5ddc67eaf250458c6409 (diff) |
argsAlreadyParsedError: arguments already parsed: cannot register CLI option
JIRA: YARDSTICK-216
Change-Id: I0368a3d1c1f5eaf9f4ef2dcb519815241f377d24
Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
-rw-r--r-- | yardstick/cmd/cli.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/yardstick/cmd/cli.py b/yardstick/cmd/cli.py index cac3dc5bf..beaa187aa 100644 --- a/yardstick/cmd/cli.py +++ b/yardstick/cmd/cli.py @@ -156,24 +156,26 @@ class YardstickCLI(): def main(self, argv): # pragma: no cover '''run the command line interface''' - self._register_cli_opt() + try: + self._register_cli_opt() - self._load_cli_config(argv) + self._load_cli_config(argv) - self._handle_global_opts() + self._handle_global_opts() - self._dispath_func_notask() - - self._clear_config_opts() + self._dispath_func_notask() + finally: + self._clear_config_opts() def api(self, argv, task_id): # pragma: no cover '''run the api interface''' - self._register_cli_opt() - - self._load_cli_config(argv) + try: + self._register_cli_opt() - self._handle_global_opts() + self._load_cli_config(argv) - self._dispath_func_task(task_id) + self._handle_global_opts() - self._clear_config_opts() + self._dispath_func_task(task_id) + finally: + self._clear_config_opts() |