From 1719dfeb69a2613eac4d63fd4c823d940b1b626a Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Mon, 24 Aug 2015 17:55:09 -0400 Subject: [PATCH] Use the oslo.config sphinx module to generate sample This commit switches to using the oslo.config sphinx extension to generate a sample config instead of doing it manually in the docs' conf.py module. Change-Id: I7032cb4f56c728911ffa5c6911eb504f53bc80af --- .gitignore | 2 +- doc/source/conf.py | 18 +++++------------- doc/source/sampleconf.rst | 5 ++--- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index f584532f68..efba45eb72 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,4 @@ build .coverage* !.coveragerc cover/ -doc/source/_static/tempest.conf +doc/source/_static/tempest.conf.sample diff --git a/doc/source/conf.py b/doc/source/conf.py index 3ec25ea114..f85899b2c7 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -15,18 +15,6 @@ import sys import os import subprocess -# Build a tempest sample config file: -def build_sample_config(app): - root_dir = os.path.dirname( - os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) - subprocess.call(["oslo-config-generator", "--config-file", - "tools/config/config-generator.tempest.conf", - "--output-file", "doc/source/_static/tempest.conf"], - cwd=root_dir) - -def setup(app): - app.connect('builder-inited', build_sample_config) - # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. @@ -42,9 +30,13 @@ def setup(app): extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.viewcode', - 'oslosphinx' + 'oslosphinx', + 'oslo_config.sphinxconfiggen', ] +config_generator_config_file = '../../tools/config/config-generator.tempest.conf' +sample_config_basename = '_static/tempest' + todo_include_todos = True # Add any paths that contain templates here, relative to this directory. diff --git a/doc/source/sampleconf.rst b/doc/source/sampleconf.rst index 2a7297116b..c2901400de 100644 --- a/doc/source/sampleconf.rst +++ b/doc/source/sampleconf.rst @@ -8,7 +8,6 @@ auto-generated from Tempest when this documentation is built, so if you are having issues with an option, please compare your version of Tempest with the version of this documentation. -The sample configuration can also be viewed in `file form <_static/tempest.conf>`_. +The sample configuration can also be viewed in `file form <_static/tempest.conf.sample>`_. -.. include:: _static/tempest.conf - :code: +.. literalinclude:: _static/tempest.conf.sample