diff --git a/autogenerate_config_docs/autohelp.py b/autogenerate_config_docs/autohelp.py
index 781408e5..db39f8da 100755
--- a/autogenerate_config_docs/autohelp.py
+++ b/autogenerate_config_docs/autohelp.py
@@ -34,6 +34,29 @@ from hooks import HOOKS
import openstack.common.config.generator as generator
+TABLE_HEADER = '''
+
+
+
+ Description of configuration options for %(cat)s
+
+
+
+
+ Configuration option = Default value |
+ Description |
+
+
+ \n'''
+
+TABLE_FOOTER = '''
+
+\n'''
+
+
register_re = re.compile(r'''^ +.*\.register_opts\((?P[^,)]+)'''
r'''(, (group=)?["'](?P.*)["'])?\)''')
@@ -255,37 +278,22 @@ def write_docbook(package_name, options, verbose=0, target='./'):
{'target': target, 'package_name': package_name,
'cat': cat})
groups_file = open(file_path, 'w')
- groups_file.write('''
-
-
-
- Description of configuration options for %(cat)s
-
-
-
-
- Configuration option = Default value |
- Description |
-
-
- \n''' % {'pkg': package_name, 'cat': cat})
+ groups_file.write(TABLE_HEADER % {'pkg': package_name,
+ 'cat': category})
curgroup = None
for optname in options_by_cat[cat]:
group, option = options.get_option(optname)
if group != curgroup:
curgroup = group
- groups_file.write('''
- [%s] |
-
\n''' % group)
+ groups_file.write('''
+ [%s] |
+
\n''' % group)
if not option.help:
option.help = "No help text available for this option."
if ((type(option).__name__ == "ListOpt") and (
type(option.default) == list)):
option.default = ", ".join(option.default)
- groups_file.write(' \n')
+ groups_file.write('
\n')
default = generator._sanitize_default(option.name,
str(option.default))
# This should be moved to generator._sanitize_default
@@ -305,15 +313,13 @@ def write_docbook(package_name, options, verbose=0, target='./'):
if uri_re.search(default):
default = default.replace(target_abspath,
'/usr/lib/python/site-packages')
- groups_file.write(' %s = %s | \n' %
+ groups_file.write(' %s = %s | \n' %
(option.dest, default))
- groups_file.write(' (%s) %s | \n' %
+ groups_file.write(' (%s) %s | \n' %
(type(option).__name__,
xml.sax.saxutils.escape(option.help)))
- groups_file.write('
\n')
- groups_file.write('''
-
- \n''')
+ groups_file.write(' \n')
+ groups_file.write(TABLE_FOOTER)
groups_file.close()
@@ -363,42 +369,24 @@ def write_docbook_rootwrap(package_name, repo, verbose=0, target='./'):
file_path = ("%(target)s/%(package_name)s-rootwrap.xml" %
{'target': target, 'package_name': package_name})
groups_file = open(file_path, 'w')
- groups_file.write('''
-
-
-
- Description of configuration options for rootwrap
-
-
-
-
- Configuration option = Default value |
- Description |
-
-
- \n''' % {'pkg': package_name})
+ groups_file.write(TABLE_HEADER % {'pkg': package_name, 'cat': 'rootwrap'})
curgroup = None
for group, optname, default, desc in options:
if group != curgroup:
curgroup = group
- groups_file.write('''
- [%s] |
-
\n''' % group)
+ groups_file.write('''
+ [%s] |
+
\n''' % group)
if desc == '':
desc = "No help text available for this option."
- groups_file.write(' \n')
+ groups_file.write('
\n')
default = generator._sanitize_default(optname, str(default))
- groups_file.write(' %s = %s | \n' %
+ groups_file.write(' %s = %s | \n' %
(optname, xml.sax.saxutils.escape(default)))
- groups_file.write(' %s | \n' %
+ groups_file.write(' %s | \n' %
xml.sax.saxutils.escape(desc))
- groups_file.write('
\n')
- groups_file.write('''
-
- \n''')
+ groups_file.write(' \n')
+ groups_file.write(TABLE_FOOTER)
groups_file.close()