Enable configfile autogeneration

This patch enables configfile autogeneration. It is triggered

* implicitly on every sphinx build
  output dir: doc/source/html/_static/nova_dpm.conf.sample
  for doc inclusion
* explicilty by tox -egenconfig
  output dir: etc/nova/nova_dpm.conf.sample
* explicitly by tox -edocs
  output dir: etc/nova/nova_dpm.conf.sample

In addition the return type of nova_dpm.conf.dpm.list_opts needed
to be changed to the default format (list of tuples).

Change-Id: Ib298b274f877d651dd846cac6525789c458da407
Closes-Bug: #1657701
This commit is contained in:
Andreas Scheuring 2017-01-26 09:05:21 +01:00
parent c89542ca11
commit 8f82f0a442
8 changed files with 38 additions and 3 deletions

4
.gitignore vendored
View File

@ -57,3 +57,7 @@ ChangeLog
# Files created by releasenotes build
releasenotes/build
# Ignore autogenerated config files
etc/nova/nova_dpm.conf.sample
doc/source/_static/nova_dpm.conf.sample

View File

@ -26,9 +26,14 @@ extensions = [
'sphinx.ext.autodoc',
#'sphinx.ext.intersphinx',
'sphinxcontrib.seqdiag',
'oslosphinx'
'oslosphinx',
'oslo_config.sphinxconfiggen'
]
config_generator_config_file = '../../etc/nova/nova-dpm-config-generator.conf'
sample_config_basename = '_static/nova_dpm'
# autodoc generation is a bit aggressive and a nuisance when doing heavy
# text edit cycles.
# execute "export SPHINX_DEBUG=1" in your terminal to disable

View File

@ -52,6 +52,7 @@ Contents:
installation
usage
contributing
sample_config
Specifications
==============

View File

@ -0,0 +1,12 @@
==============================
Nova-dpm Configuration Options
==============================
The following is a sample Nova-dpm configuration for adaptation and use.
It is auto-generated from Nova-dpm when this documentation is built, so
if you are having issues with an option, please compare your version of
Nova-dpm with the version of this documentation.
The sample configuration can also be viewed in `file form <_static/nova_dpm.conf.sample>`_.
.. literalinclude:: _static/nova_dpm.conf.sample

View File

@ -0,0 +1,4 @@
[DEFAULT]
output_file = etc/nova/nova_dpm.conf.sample
wrap_width = 80
namespace = nova_dpm

View File

@ -59,4 +59,4 @@ def register_opts(conf):
def list_opts():
return {dpm_group: ALL_DPM_OPTS}
return [(dpm_group, ALL_DPM_OPTS)]

View File

@ -52,3 +52,6 @@ all_files = 1
build-dir = releasenotes/build
source-dir = releasenotes/source
[entry_points]
oslo.config.opts =
nova_dpm = nova_dpm.conf.dpm:list_opts

View File

@ -4,6 +4,7 @@ envlist = py35,py34,py27,pep8
skipsdist = True
[testenv]
usedevelop = True
# NOTE(markus_z): We need the commands keyword, otherwise tox 2.5.0 throws an error.
# See https://bugs.launchpad.net/charm-aodh/+bug/1642981 and
# https://github.com/tox-dev/tox/issues/316
@ -29,7 +30,9 @@ commands =
coverage report
[testenv:docs]
commands = python setup.py build_sphinx
commands =
python setup.py build_sphinx
oslo-config-generator --config-file=etc/nova/nova-dpm-config-generator.conf
[testenv:debug]
commands = oslo_debug_helper {posargs}
@ -41,3 +44,6 @@ show-source = True
ignore = E123,E125
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,.tmp
[testenv:genconfig]
commands = oslo-config-generator --config-file=etc/nova/nova-dpm-config-generator.conf