aboutsummaryrefslogtreecommitdiffstats
path: root/api/views.py
diff options
context:
space:
mode:
authorJing Lu <lvjing5@huawei.com>2016-11-30 04:57:29 +0000
committerGerrit Code Review <gerrit@opnfv.org>2016-11-30 04:57:29 +0000
commit59aff2e16b819df0731ac8d2cf47cab112df9178 (patch)
treeb966208131ae47878f05ab20419871ce3b1437c2 /api/views.py
parentdd4bf5acef87d7c58c0aae3950ef5da386533f5a (diff)
parentc383ae3fa6ccb865575eacf78209fdd3ac7efa69 (diff)
Merge "Create API and command to create a influxDB container"
Diffstat (limited to 'api/views.py')
-rw-r--r--api/views.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/api/views.py b/api/views.py
index e78389f5a..7357625e0 100644
--- a/api/views.py
+++ b/api/views.py
@@ -14,6 +14,7 @@ from flask_restful import Resource
from api.utils import common as common_utils
from api.actions import test as test_action
from api.actions import result as result_action
+from api.actions import env as env_action
logger = logging.getLogger(__name__)
@@ -40,3 +41,15 @@ class Result(Resource):
return getattr(result_action, action)(args)
except AttributeError:
return common_utils.error_handler('Wrong action')
+
+
+class Env(Resource):
+ def post(self):
+ action = common_utils.translate_to_str(request.json.get('action', ''))
+ args = common_utils.translate_to_str(request.json.get('args', {}))
+ logger.debug('Input args is: action: %s, args: %s', action, args)
+
+ try:
+ return getattr(env_action, action)(args)
+ except AttributeError:
+ return common_utils.error_handler('Wrong action')