aboutsummaryrefslogtreecommitdiffstats
path: root/functest/api/resources/v1/envs.py
diff options
context:
space:
mode:
authorLinda Wang <wangwulin@huawei.com>2017-08-21 14:36:22 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-08-21 14:36:22 +0000
commit2cfa22a0d0aa86cee5d77707c2f06ef3c4434a14 (patch)
treef4add964b9404c889d10cad47af332642be7c0bd /functest/api/resources/v1/envs.py
parentf9fc2c1df0c6293df3f7c5e413a8aab643a4177a (diff)
parent26efacba9304071956d16a9a50a18e8f243518bb (diff)
Merge "Create API to run a test case"
Diffstat (limited to 'functest/api/resources/v1/envs.py')
-rw-r--r--functest/api/resources/v1/envs.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/functest/api/resources/v1/envs.py b/functest/api/resources/v1/envs.py
index 35bffb04..9c455198 100644
--- a/functest/api/resources/v1/envs.py
+++ b/functest/api/resources/v1/envs.py
@@ -14,6 +14,7 @@ from flask import jsonify
from functest.api.base import ApiResource
from functest.cli.commands.cli_env import Env
+from functest.api.common import api_utils
import functest.utils.functest_utils as ft_utils
@@ -31,4 +32,9 @@ class V1Envs(ApiResource):
def prepare(self, args): # pylint: disable=no-self-use, unused-argument
""" Prepare environment """
- ft_utils.execute_command("prepare_env start")
+ 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))
+ return api_utils.result_handler(
+ status=0, data="Prepare env successfully")