doc: Ignore warnings from dashboard build in the doc build

There is no need to catch warnings from openstack_dashboard.settings
in the doc build job. This might be a bug of a recent Sphinx 1.6.x,
but I think it is useful to have this setting to avoid unexpected failures.

Change-Id: I9894622ba0f5fbb74e9dac016ed76ac9e3c2f733
This commit is contained in:
Akihiro Motoki 2017-06-01 02:36:38 +00:00
parent 7a5b4a71a3
commit 117cec9b54
2 changed files with 17 additions and 7 deletions

View File

@ -25,11 +25,19 @@
from __future__ import print_function
import django
import logging
import os
import subprocess
import sys
import warnings
# NOTE(amotoki): Sphinx 1.6.x catches warnings from imported modules.
# Ignore warnings from openstack_dashboard.settings in the doc build.
# This can be dropped once Sphinx correctly ignore such warnings.
logging.getLogger('openstack_dashboard.settings').setLevel(logging.ERROR)
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.abspath(os.path.join(BASE_DIR, "..", ".."))

View File

@ -32,6 +32,8 @@ from horizon.utils.escape import monkeypatch_escape
monkeypatch_escape()
_LOG = logging.getLogger(__name__)
warnings.formatwarning = lambda message, category, *args, **kwargs: \
'%s: %s' % (category.__name__, message)
@ -318,7 +320,7 @@ OPENSTACK_PROFILER = {
try:
from local.local_settings import * # noqa: F403,H303
except ImportError:
logging.warning("No local_settings file found.")
_LOG.warning("No local_settings file found.")
# configure template debugging
TEMPLATES[0]['OPTIONS']['debug'] = DEBUG
@ -346,7 +348,7 @@ if os.path.exists(LOCAL_SETTINGS_DIR_PATH):
with open(os.path.join(dirpath, filename)) as f:
exec(f.read())
except Exception as e:
logging.exception(
_LOG.exception(
"Can not exec settings snippet %s", filename)
# The purpose of OPENSTACK_IMAGE_FORMATS is to provide a simple object
@ -384,12 +386,12 @@ AVAILABLE_THEMES, DEFAULT_THEME = theme_settings.get_available_themes(
)
if CUSTOM_THEME_PATH is not None:
logging.warning("CUSTOM_THEME_PATH has been deprecated. Please convert "
"your settings to make use of AVAILABLE_THEMES.")
_LOG.warning("CUSTOM_THEME_PATH has been deprecated. Please convert "
"your settings to make use of AVAILABLE_THEMES.")
if DEFAULT_THEME_PATH is not None:
logging.warning("DEFAULT_THEME_PATH has been deprecated. Please convert "
"your settings to make use of AVAILABLE_THEMES.")
_LOG.warning("DEFAULT_THEME_PATH has been deprecated. Please convert "
"your settings to make use of AVAILABLE_THEMES.")
# Discover all the directories that contain static files; at the same time
# discover all the xstatic module entry points to embed in our HTML
@ -456,4 +458,4 @@ if 'HORIZON_IMAGES_ALLOW_UPLOAD' in globals():
if not HORIZON_IMAGES_ALLOW_UPLOAD:
message += ' Keep in mind that HORIZON_IMAGES_ALLOW_UPLOAD set to ' \
'False overrides the value of HORIZON_IMAGES_UPLOAD_MODE.'
logging.warning(message)
_LOG.warning(message)