diff --git a/roles/sphinx/README.rst b/roles/sphinx/README.rst index fcad72530..5a4929260 100644 --- a/roles/sphinx/README.rst +++ b/roles/sphinx/README.rst @@ -19,8 +19,10 @@ Run sphinx to generate documentation .. zuul:rolevar:: sphinx_warning_is_error - Whether to treat sphinx build warnings as errors. Defaults to undefined - which means to attempt to find the setting in a setup.cfg file. + Whether to treat sphinx build warnings as errors. Defaults to the value of + ``[build_sphinx] warning-is-error`` in ``setup.cfg`` if defined, ``False`` + if the ``[build_sphinx]`` section is present but the ``warning-is-error`` + option is undefined, or ``True`` if the entire section is undefined. .. zuul:rolevar:: zuul_work_virtualenv :default: ~/.venv diff --git a/roles/sphinx/library/sphinx_check_warning_is_error.py b/roles/sphinx/library/sphinx_check_warning_is_error.py index d067d2017..275d8c0a7 100644 --- a/roles/sphinx/library/sphinx_check_warning_is_error.py +++ b/roles/sphinx/library/sphinx_check_warning_is_error.py @@ -68,7 +68,7 @@ def main(): ) project_dir = module.params['project_dir'] - warning_is_error = False + warning_is_error = True # TODO(mordred) Remove autodoc_index_modules logic when we get OpenStack # projects off of the pbr autoindex autodoc_index_modules = False @@ -91,9 +91,11 @@ def main(): autodoc_index_modules=autodoc_index_modules, msg="Error reading setup.cfg, defaulting flags to false") - if (c.has_section('build_sphinx') and - c.has_option('build_sphinx', 'warning-is-error')): - warning_is_error = c.getboolean('build_sphinx', 'warning-is-error') + if c.has_section('build_sphinx'): + if c.has_option('build_sphinx', 'warning-is-error'): + warning_is_error = c.getboolean('build_sphinx', 'warning-is-error') + else: + warning_is_error = False if c.has_section('pbr') and c.has_option('pbr', 'autodoc_index_modules'): autodoc_index_modules = c.getboolean('pbr', 'autodoc_index_modules') if (c.has_section('pbr') and