aboutsummaryrefslogtreecommitdiffstats
path: root/functest/api
diff options
context:
space:
mode:
authorLinda Wang <wangwulin@huawei.com>2017-08-28 06:11:23 +0000
committerLinda Wang <wangwulin@huawei.com>2017-08-28 06:21:35 +0000
commit842261043f74b35c61889ee886e480dd280a5c0d (patch)
treea0851e540a2e6f263d5e98250ccd5b166c61f2e4 /functest/api
parentaf86e67845ff7d074d389aa54cd4c3744d037348 (diff)
Launch Functest RestApi once the container is run
And fix the handling about env prepare exception. Change-Id: I3e590e63157182c442602367a244d7ff647f8b7d Signed-off-by: Linda Wang <wangwulin@huawei.com>
Diffstat (limited to 'functest/api')
-rw-r--r--functest/api/resources/v1/envs.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/functest/api/resources/v1/envs.py b/functest/api/resources/v1/envs.py
index fb76fa63f..8020544fb 100644
--- a/functest/api/resources/v1/envs.py
+++ b/functest/api/resources/v1/envs.py
@@ -33,10 +33,11 @@ class V1Envs(ApiResource):
def prepare(self, args): # pylint: disable=no-self-use, unused-argument
""" Prepare environment """
- try:
- ft_utils.execute_command("prepare_env start")
- except Exception as err: # pylint: disable=broad-except
- return api_utils.result_handler(status=1, data=str(err))
+
+ result_env = ft_utils.execute_command("prepare_env start")
+ if not result_env == 0:
+ return api_utils.result_handler(
+ status=1, data="Failed to prepare env")
return api_utils.result_handler(
status=0, data="Prepare env successfully")