Disable urllib3 warnings 77/40677/4
authorLinda Wang <wangwulin@huawei.com>
Wed, 30 Aug 2017 09:00:27 +0000 (09:00 +0000)
committerLinda Wang <wangwulin@huawei.com>
Wed, 13 Sep 2017 06:12:52 +0000 (06:12 +0000)
1. When running in compass OSA, lots of SubjectAltNameWarnings are
   shown in console, so just disable the warnings here.
   See https://github.com/shazow/urllib3/issues/497 for details
2. Redirect warnings issued by the warnings module to the logging system
   via logging.captureWarnings(True)
3. But urllib3 warning is still there for two cmds about rally/tempest.

Change-Id: Ic22cf8e2babc10c9d55a7ed46b841312a4e430a7
Signed-off-by: Linda Wang <wangwulin@huawei.com>
functest/api/server.py
functest/ci/check_deployment.py
functest/ci/prepare_env.py
functest/ci/run_tests.py
functest/cli/cli_base.py

index 1d47b0d..c6eb0b3 100644 (file)
@@ -97,6 +97,7 @@ def main():
     """Entry point"""
     logging.config.fileConfig(pkg_resources.resource_filename(
         'functest', 'ci/logging.ini'))
+    logging.captureWarnings(True)
     LOGGER.info('Starting Functest server')
     api_add_resource()
     init_db()
index fe20dc8..13bb4c8 100644 (file)
@@ -159,5 +159,6 @@ def main():
     """Entry point"""
     logging.config.fileConfig(pkg_resources.resource_filename(
         'functest', 'ci/logging.ini'))
+    logging.captureWarnings(True)
     deployment = CheckDeployment()
     return deployment.check_all()
index a354dbe..36d0429 100644 (file)
@@ -37,14 +37,14 @@ pod_arch = os.getenv("POD_ARCH", None)
 arch_filter = ['aarch64']
 
 CONFIG_FUNCTEST_PATH = pkg_resources.resource_filename(
-            'functest', 'ci/config_functest.yaml')
+    'functest', 'ci/config_functest.yaml')
 CONFIG_PATCH_PATH = pkg_resources.resource_filename(
-            'functest', 'ci/config_patch.yaml')
+    'functest', 'ci/config_patch.yaml')
 CONFIG_AARCH64_PATCH_PATH = pkg_resources.resource_filename(
-            'functest', 'ci/config_aarch64_patch.yaml')
+    'functest', 'ci/config_aarch64_patch.yaml')
 RALLY_CONF_PATH = "/etc/rally/rally.conf"
 RALLY_AARCH64_PATCH_PATH = pkg_resources.resource_filename(
-            'functest', 'ci/rally_aarch64_patch.conf')
+    'functest', 'ci/rally_aarch64_patch.conf')
 
 
 class PrepareEnvParser(object):
@@ -358,6 +358,7 @@ def prepare_env(**kwargs):
 def main():
     logging.config.fileConfig(pkg_resources.resource_filename(
         'functest', 'ci/logging.ini'))
+    logging.captureWarnings(True)
     parser = PrepareEnvParser()
     args = parser.parse_args(sys.argv[1:])
     return prepare_env(**args)
index feafa89..a129ea7 100644 (file)
@@ -264,6 +264,7 @@ class Runner(object):
 def main():
     logging.config.fileConfig(pkg_resources.resource_filename(
         'functest', 'ci/logging.ini'))
+    logging.captureWarnings(True)
     parser = RunTestsParser()
     args = parser.parse_args(sys.argv[1:])
     runner = Runner()
index 54b3e72..507179b 100644 (file)
@@ -25,6 +25,7 @@ CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
 def cli():
     logging.config.fileConfig(pkg_resources.resource_filename(
         'functest', 'ci/logging.ini'))
+    logging.captureWarnings(True)
 
 
 _env = CliEnv()