From 1b9eeb504ed9416c74e1caf8975b51ee6af86b29 Mon Sep 17 00:00:00 2001 From: chenjiankun Date: Fri, 30 Jun 2017 02:32:55 +0000 Subject: Change prepareYardstickEnv to prepare_env and add log info JIRA: YARDSTICK-697 Currently the action in env like prepareYardstickEnv, createGrafanaContainer, createInfluxDBContainer, this is not python style. So I do some change: prepareYardstickEnv->prepare_env createGrafanaContainer->create_grafana createInfluxDBContainer->create_influxdb And also add some log info in env_action. Change-Id: Ia91576b975f3de76b96e312779fda4911e7cac24 Signed-off-by: chenjiankun --- api/base.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'api/base.py') diff --git a/api/base.py b/api/base.py index 6fa2777ce..bd967bbae 100644 --- a/api/base.py +++ b/api/base.py @@ -15,6 +15,7 @@ from flask import request from flask_restful import Resource from api.utils import common as common_utils +from yardstick.common import constants as consts logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) @@ -59,5 +60,5 @@ class ApiResource(Resource): resources = importlib.import_module(module_name) try: return getattr(resources, action)(args) - except NameError: - common_utils.error_handler('Wrong action') + except AttributeError: + common_utils.result_handler(consts.API_ERROR, 'No such action') -- cgit 1.2.3-korg