diff options
author | 2022-03-03 15:29:16 +0100 | |
---|---|---|
committer | 2022-03-04 10:32:25 +0100 | |
commit | 5ab58cf461b7803e4c9c5c0983e8c397468d27a8 (patch) | |
tree | 850337598a8aa666f40761ddeb12485137b22e25 /xtesting/core/campaign.py | |
parent | 98189214d82232f8a24a3a53c9033cd782157635 (diff) |
Search config files in tree
It allows putting configurations in classical dirs.
It fallbacks to the python package for backward compatibility.
Change-Id: Ie33b9482fb197926c7d7d66ace815fa4ae01d02d
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'xtesting/core/campaign.py')
-rw-r--r-- | xtesting/core/campaign.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/xtesting/core/campaign.py b/xtesting/core/campaign.py index dbde42df..5ca47d6e 100644 --- a/xtesting/core/campaign.py +++ b/xtesting/core/campaign.py @@ -21,11 +21,11 @@ from urllib.parse import urlparse import boto3 from boto3.s3.transfer import TransferConfig import botocore -import pkg_resources import requests from xtesting.core import testcase from xtesting.utils import env +from xtesting.utils import config from xtesting.utils import constants __author__ = "Cedric Ollivier <cedric.ollivier@orange.com>" @@ -120,7 +120,7 @@ class Campaign(): dst_s3_url = os.environ["S3_DST_URL"] multipart_threshold = 5 * 1024 ** 5 if "google" in os.environ[ "S3_ENDPOINT_URL"] else 8 * 1024 * 1024 - config = TransferConfig(multipart_threshold=multipart_threshold) + tconfig = TransferConfig(multipart_threshold=multipart_threshold) bucket_name = urlparse(dst_s3_url).netloc s3path = re.search( '^/*(.*)/*$', urlparse(dst_s3_url).path).group(1) @@ -136,7 +136,7 @@ class Campaign(): b3resource.Bucket(bucket_name).download_file( s3_object.key, re.sub(f'^{s3path}/*', '', s3_object.key), - Config=config) + Config=tconfig) Campaign.__logger.info( "Downloading %s", re.sub(f'^{s3path}/*', '', s3_object.key)) @@ -183,7 +183,7 @@ class Campaign(): dst_s3_url = os.environ["S3_DST_URL"] multipart_threshold = 5 * 1024 ** 5 if "google" in os.environ[ "S3_ENDPOINT_URL"] else 8 * 1024 * 1024 - config = TransferConfig(multipart_threshold=multipart_threshold) + tconfig = TransferConfig(multipart_threshold=multipart_threshold) bucket_name = urlparse(dst_s3_url).netloc mime_type = mimetypes.guess_type(f'{build_tag}.zip') path = urlparse(dst_s3_url).path.strip("/") @@ -191,7 +191,7 @@ class Campaign(): b3resource.Bucket(bucket_name).upload_file( f'{build_tag}.zip', os.path.join(path, f'{build_tag}.zip'), - Config=config, + Config=tconfig, ExtraArgs={'ContentType': mime_type[ 0] or 'application/octet-stream'}) dst_http_url = os.environ["HTTP_DST_URL"] @@ -217,10 +217,10 @@ def main(): if not os.path.exists(testcase.TestCase.dir_results): os.makedirs(testcase.TestCase.dir_results) if env.get('DEBUG').lower() == 'true': - logging.config.fileConfig(pkg_resources.resource_filename( - 'xtesting', constants.DEBUG_INI_PATH)) + logging.config.fileConfig(config.get_xtesting_config( + 'logging.debug.ini', constants.DEBUG_INI_PATH_DEFAULT)) else: - logging.config.fileConfig(pkg_resources.resource_filename( - 'xtesting', constants.INI_PATH)) + logging.config.fileConfig(config.get_xtesting_config( + 'logging.ini', constants.INI_PATH_DEFAULT)) logging.captureWarnings(True) Campaign.zip_campaign_files() |