From 9f7c63ffaf64b3ca81ae86a0b3477e5007916fcd Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Thu, 22 Feb 2018 17:43:35 +0100 Subject: Switch from CONST to CONF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It also removes constants.CONST and env.Environment which are now useless. Depends-On: I764a0a2a24447c941d1e726f3116593b29dd1c1e Depends-On: I6cfa832466dcefd737314633d807512e46267a69 Change-Id: Ife41c59d9f2e6ec4e49df38af962039f99554bc5 Signed-off-by: Cédric Ollivier --- functest/api/resources/v1/tasks.py | 6 +++--- functest/api/resources/v1/testcases.py | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'functest/api/resources/v1') diff --git a/functest/api/resources/v1/tasks.py b/functest/api/resources/v1/tasks.py index 5af8a678..30501adf 100644 --- a/functest/api/resources/v1/tasks.py +++ b/functest/api/resources/v1/tasks.py @@ -15,16 +15,16 @@ import errno import json import logging import os -import pkg_resources import uuid from flask import jsonify from flasgger.utils import swag_from +import pkg_resources from functest.api.base import ApiResource from functest.api.common import api_utils from functest.api.database.v1.handlers import TasksHandler -from functest.utils.constants import CONST +from functest.utils import config LOGGER = logging.getLogger(__name__) @@ -85,7 +85,7 @@ class V1TaskLog(ApiResource): except ValueError: return api_utils.result_handler(status=1, data='No such task id') - task_log_dir = getattr(CONST, 'dir_results') + task_log_dir = getattr(config.CONF, 'dir_results') # pylint: disable=maybe-no-member index = int(self._get_args().get('index', 0)) diff --git a/functest/api/resources/v1/testcases.py b/functest/api/resources/v1/testcases.py index 064661c8..2dbf97e4 100644 --- a/functest/api/resources/v1/testcases.py +++ b/functest/api/resources/v1/testcases.py @@ -26,7 +26,7 @@ from functest.api.base import ApiResource from functest.api.common import api_utils, thread from functest.cli.commands.cli_testcase import Testcase from functest.api.database.v1.handlers import TasksHandler -from functest.utils.constants import CONST +from functest.utils import config from functest.utils import env import functest.utils.functest_utils as ft_utils @@ -144,14 +144,14 @@ class V1Testcase(ApiResource): def _update_logging_ini(self, task_id): # pylint: disable=no-self-use """ Update the log file for each task""" - config = ConfigParser.RawConfigParser() - config.read( + rconfig = ConfigParser.RawConfigParser() + rconfig.read( pkg_resources.resource_filename('functest', 'ci/logging.ini')) - log_path = os.path.join(getattr(CONST, 'dir_results'), + log_path = os.path.join(getattr(config.CONF, 'dir_results'), '{}.log'.format(task_id)) - config.set('handler_file', 'args', '("{}",)'.format(log_path)) + rconfig.set('handler_file', 'args', '("{}",)'.format(log_path)) with open( pkg_resources.resource_filename( 'functest', 'ci/logging.ini'), 'wb') as configfile: - config.write(configfile) + rconfig.write(configfile) -- cgit 1.2.3-korg