diff options
author | Jing Lu <lvjing5@huawei.com> | 2016-11-30 04:57:29 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2016-11-30 04:57:29 +0000 |
commit | 59aff2e16b819df0731ac8d2cf47cab112df9178 (patch) | |
tree | b966208131ae47878f05ab20419871ce3b1437c2 /api/views.py | |
parent | dd4bf5acef87d7c58c0aae3950ef5da386533f5a (diff) | |
parent | c383ae3fa6ccb865575eacf78209fdd3ac7efa69 (diff) |
Merge "Create API and command to create a influxDB container"
Diffstat (limited to 'api/views.py')
-rw-r--r-- | api/views.py | 13 |
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') |