Clean output of driver list generation

The driver list generation takes driver docstrings and attempts
to parse that into rst formatted output for publication. With the
way this content is formatted within the docstring, this would
cause some slightly off formatting in the html output.

This attempts to better extract that information to make the
output cleaner and more readable.

Change-Id: I3b7e0817ade1c86b6d157c96872f00bb1b99c3d8
This commit is contained in:
Sean McGinnis 2018-04-25 17:15:23 -05:00
parent 9aa6c97e00
commit 113b383196

View File

@ -17,6 +17,7 @@
import argparse
import os
import json
import textwrap
from cinder.interface import util
from cinder import objects
@ -68,9 +69,9 @@ class Output(object):
def format_description(desc, output):
desc = desc or '<None>'
lines = desc.rstrip('\n').split('\n')
for line in lines:
output.write(' %s' % line)
output.write('* Description: %s' % lines[0])
output.write('')
output.write(textwrap.dedent('\n'.join(lines[1:])))
def print_drivers(drivers, config_name, output):
for driver in sorted(drivers, key=lambda x: x.class_fqn):
@ -85,7 +86,6 @@ def print_drivers(drivers, config_name, output):
if driver.ci_wiki_name and 'Cinder_Jenkins' not in driver.ci_wiki_name:
output.write('* CI info: %s%s' % (CI_WIKI_ROOT,
driver.ci_wiki_name))
output.write('* Description:')
format_description(driver.desc, output)
output.write('')
output.write('')