have show-options load the generator config file
Add an option to the show-options directive to read existing configuration files for the sample config generator instead of making the author provide the list of namespaces inline. Change-Id: I0ec46cc7aa820ae592d8e4e7b56ee98f0c5cbfb4 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
e056c80dd1
commit
ad440d7957
@ -29,6 +29,14 @@ two roles.
|
|||||||
oslo.config
|
oslo.config
|
||||||
oslo.log
|
oslo.log
|
||||||
|
|
||||||
|
To use an existing configuration file for the sample configuration
|
||||||
|
generator, use the ``config-file`` option instead of specifying the
|
||||||
|
namespaces inline.
|
||||||
|
::
|
||||||
|
|
||||||
|
.. show-options::
|
||||||
|
:config-file: etc/oslo-config-generator/glance-api.conf
|
||||||
|
|
||||||
.. rst:role:: option
|
.. rst:role:: option
|
||||||
|
|
||||||
Link to an option.
|
Link to an option.
|
||||||
|
@ -68,6 +68,7 @@ class ShowOptionsDirective(rst.Directive):
|
|||||||
|
|
||||||
option_spec = {
|
option_spec = {
|
||||||
'split-namespaces': directives.flag,
|
'split-namespaces': directives.flag,
|
||||||
|
'config-file': directives.unchanged,
|
||||||
}
|
}
|
||||||
|
|
||||||
has_content = True
|
has_content = True
|
||||||
@ -90,11 +91,22 @@ class ShowOptionsDirective(rst.Directive):
|
|||||||
|
|
||||||
split_namespaces = 'split-namespaces' in self.options
|
split_namespaces = 'split-namespaces' in self.options
|
||||||
|
|
||||||
namespaces = [
|
config_file = self.options.get('config-file')
|
||||||
c.strip()
|
if config_file:
|
||||||
for c in self.content
|
app.info('loading config file %s' % config_file)
|
||||||
if c.strip()
|
conf = cfg.ConfigOpts()
|
||||||
]
|
conf.register_opts(generator._generator_opts)
|
||||||
|
conf(
|
||||||
|
args=['--config-file', config_file],
|
||||||
|
project='oslo.config.sphinxext',
|
||||||
|
)
|
||||||
|
namespaces = conf.namespace[:]
|
||||||
|
else:
|
||||||
|
namespaces = [
|
||||||
|
c.strip()
|
||||||
|
for c in self.content
|
||||||
|
if c.strip()
|
||||||
|
]
|
||||||
|
|
||||||
opts = generator._list_opts(namespaces)
|
opts = generator._list_opts(namespaces)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user