From fbb330caa2e0fb466542db1922f3d9069b7ef33e Mon Sep 17 00:00:00 2001 From: Lucian Petrut Date: Fri, 10 Nov 2017 19:35:47 +0200 Subject: [PATCH] Add config sample to compute-hyperv docs This change adds an automatically generated config sample to the compute-hyperv docs. The config sample is generated each time the docs are built, using the oslo.config sphinxconfiggen extension. Change-Id: Id8fa0311d653a438b143018f032e32d3eb6bbaa8 Related-Bug: #1731511 --- .gitignore | 2 ++ doc/source/conf.py | 6 +++++- doc/source/index.rst | 10 +++++----- doc/source/sample_config.rst | 20 ++++++++++++++++++++ etc/compute-hyperv-config-generator.conf | 10 ++++++++++ test-requirements.txt | 1 + 6 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 doc/source/sample_config.rst create mode 100644 etc/compute-hyperv-config-generator.conf diff --git a/.gitignore b/.gitignore index 8a3c7042..243634d5 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,8 @@ output/*/index.html # Sphinx doc/build +doc/source/_static/compute-hyperv.conf.sample +etc/compute-hyperv.conf.sample # pbr generates these AUTHORS diff --git a/doc/source/conf.py b/doc/source/conf.py index 4bc34fc9..7812623d 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -22,6 +22,7 @@ sys.path.insert(0, os.path.abspath('../..')) # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ 'sphinx.ext.autodoc', + 'oslo_config.sphinxconfiggen', #'sphinx.ext.intersphinx', 'oslosphinx' ] @@ -33,6 +34,9 @@ extensions = [ # The suffix of source filenames. source_suffix = '.rst' +config_generator_config_file = '../../etc/compute-hyperv-config-generator.conf' +sample_config_basename = '_static/compute-hyperv' + # The master toctree document. master_doc = 'index' @@ -56,7 +60,7 @@ pygments_style = 'sphinx' # Sphinx are currently 'default' and 'sphinxdoc'. # html_theme_path = ["."] # html_theme = '_theme' -# html_static_path = ['static'] +html_static_path = ['_static'] # Output file base name for HTML help builder. htmlhelp_basename = '%sdoc' % project diff --git a/doc/source/index.rst b/doc/source/index.rst index 7f51f454..2837c97c 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -16,10 +16,10 @@ Contents: usage contributing -Indices and tables -================== +Sample Configuration File +------------------------- -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` +.. toctree:: + :maxdepth: 1 + sample_config diff --git a/doc/source/sample_config.rst b/doc/source/sample_config.rst new file mode 100644 index 00000000..985d3861 --- /dev/null +++ b/doc/source/sample_config.rst @@ -0,0 +1,20 @@ +==================================== +Compute-hyperv Configuration Options +==================================== + +The following is a sample compute-hyperv configuration for adaptation and +use. + +The sample configuration can also be viewed in :download:`file from +`. + +Config options that are specific to the Hyper-V Nova driver can be found in +the '[hyperv]' config group section. + +.. important:: + + The sample configuration file is auto-generated from compute-hyperv when + this documentation is built. You must ensure your version of + compute-hyperv matches the version of this documentation. + +.. literalinclude:: /_static/compute-hyperv.conf.sample diff --git a/etc/compute-hyperv-config-generator.conf b/etc/compute-hyperv-config-generator.conf new file mode 100644 index 00000000..f65fe8a8 --- /dev/null +++ b/etc/compute-hyperv-config-generator.conf @@ -0,0 +1,10 @@ +[DEFAULT] +output_file = etc/compute-hyperv.conf.sample +wrap_width = 80 + +namespace = compute_hyperv +namespace = os_win +namespace = nova.conf +namespace = oslo.log +namespace = oslo.messaging +namespace = oslo.concurrency diff --git a/test-requirements.txt b/test-requirements.txt index 1d2462bd..14ef7d4f 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -8,6 +8,7 @@ coverage!=4.4,>=4.0 # Apache-2.0 ddt>=1.0.1 # MIT python-subunit>=0.0.18 # Apache-2.0/BSD sphinx>=1.6.2 # BSD +oslo.config>=4.6.0 # Apache-2.0 oslosphinx>=4.7.0 # Apache-2.0 oslotest>=1.10.0 # Apache-2.0 testrepository>=0.0.18 # Apache-2.0/BSD