summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRex Lee <limingjiang@huawei.com>2016-12-05 06:40:58 +0000
committerGerrit Code Review <gerrit@opnfv.org>2016-12-05 06:40:58 +0000
commitef6ef8ed8f81d950a2c3a1a6f95c1e83879a9310 (patch)
tree02b0fbfd40229516b63a955294dc833b5fd24724
parentce64e77f9e97d3cad4be9c8fee068a2a5b557f3e (diff)
parent81a84601d1ecb5312e4e3904167f2a2e60365f2a (diff)
Merge "argsAlreadyParsedError: arguments already parsed: cannot register CLI option"
-rw-r--r--yardstick/cmd/cli.py26
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()