diff options
author | Matt Davis <nitzmahone@users.noreply.github.com> | 2016-12-07 14:50:17 -0800 |
---|---|---|
committer | Matt Clay <matt@mystile.com> | 2016-12-08 11:35:20 -0500 |
commit | 0b47c908ebe3b6816ba34ecd6c1c40ed51fa7e4f (patch) | |
tree | 979350bf7d988d6af883219621d1a082656eb907 /hacking | |
parent | 250b0dff46c8e7656c8108c0f8132845712d9661 (diff) | |
download | ansible-0b47c908ebe3b6816ba34ecd6c1c40ed51fa7e4f.tar.gz |
quick and dirty module doc updates (#18944)
clean up core/extras, plumb in basic metadata display
Diffstat (limited to 'hacking')
-rwxr-xr-x | hacking/module_formatter.py | 29 | ||||
-rw-r--r-- | hacking/templates/rst.j2 | 8 |
2 files changed, 15 insertions, 22 deletions
diff --git a/hacking/module_formatter.py b/hacking/module_formatter.py index e23994e371..1ae4d2a2fb 100755 --- a/hacking/module_formatter.py +++ b/hacking/module_formatter.py @@ -64,7 +64,6 @@ _URL = re.compile(r"U\(([^)]+)\)") _CONST = re.compile(r"C\(([^)]+)\)") DEPRECATED = " (D)" -NOTCORE = " (E)" ##################################################################################### def rst_ify(text): @@ -258,15 +257,14 @@ def process_module(module, options, env, template, outputname, module_map, alias sys.stderr.write("*** ERROR: MODULE MISSING DOCUMENTATION: %s, %s ***\n" % (fname, module)) sys.exit(1) + if metadata is None: + sys.stderr.write("*** ERROR: MODULE MISSING METADATA: %s, %s ***\n" % (fname, module)) + sys.exit(1) + if deprecated and 'deprecated' not in doc: sys.stderr.write("*** ERROR: DEPRECATED MODULE MISSING 'deprecated' DOCUMENTATION: %s, %s ***\n" % (fname, module)) sys.exit(1) - if "/core/" in fname: - doc['core'] = True - else: - doc['core'] = False - if module in aliases: doc['aliases'] = aliases[module] @@ -310,6 +308,8 @@ def process_module(module, options, env, template, outputname, module_map, alias doc['now_date'] = datetime.date.today().strftime('%Y-%m-%d') doc['ansible_version'] = options.ansible_version doc['plainexamples'] = examples #plain text + doc['metadata'] = metadata + if returndocs: try: doc['returndocs'] = yaml.safe_load(returndocs) @@ -330,15 +330,13 @@ def process_module(module, options, env, template, outputname, module_map, alias ##################################################################################### -def print_modules(module, category_file, deprecated, core, options, env, template, outputname, module_map, aliases): +def print_modules(module, category_file, deprecated, options, env, template, outputname, module_map, aliases): modstring = module if modstring.startswith('_'): modstring = module[1:] modname = modstring if module in deprecated: modstring = modstring + DEPRECATED - elif module not in core: - modstring = modstring + NOTCORE category_file.write(" %s - %s <%s_module>\n" % (to_bytes(modstring), to_bytes(rst_ify(module_map[module][1])), to_bytes(modname))) @@ -374,21 +372,16 @@ def process_category(category, categories, options, env, template, outputname): modules = [] deprecated = [] - core = [] for module in module_map.keys(): if isinstance(module_map[module], dict): for mod in (m for m in module_map[module].keys() if m in module_info): if mod.startswith("_"): deprecated.append(mod) - elif '/core/' in module_info[mod][0]: - core.append(mod) else: if module not in module_info: continue if module.startswith("_"): deprecated.append(module) - elif '/core/' in module_info[module][0]: - core.append(module) modules.append(module) modules.sort(key=lambda k: k[1:] if k.startswith('_') else k) @@ -409,7 +402,7 @@ def process_category(category, categories, options, env, template, outputname): sections.append(module) continue else: - print_modules(module, category_file, deprecated, core, options, env, template, outputname, module_info, aliases) + print_modules(module, category_file, deprecated, options, env, template, outputname, module_info, aliases) sections.sort() for section in sections: @@ -420,14 +413,12 @@ def process_category(category, categories, options, env, template, outputname): section_modules.sort(key=lambda k: k[1:] if k.startswith('_') else k) #for module in module_map[section]: for module in (m for m in section_modules if m in module_info): - print_modules(module, category_file, deprecated, core, options, env, template, outputname, module_info, aliases) + print_modules(module, category_file, deprecated, options, env, template, outputname, module_info, aliases) category_file.write("""\n\n .. note:: - %s: This marks a module as deprecated, which means a module is kept for backwards compatibility but usage is discouraged. The module documentation details page may explain more about this rationale. - - %s: This marks a module as 'extras', which means it ships with ansible but may be a newer module and possibly (but not necessarily) less actively maintained than 'core' modules. - - Tickets filed on modules are filed to different repos than those on the main open source project. Core module tickets should be filed at `ansible/ansible-modules-core on GitHub <http://github.com/ansible/ansible-modules-core>`_, extras tickets to `ansible/ansible-modules-extras on GitHub <http://github.com/ansible/ansible-modules-extras>`_ -""" % (DEPRECATED, NOTCORE)) +""" % DEPRECATED) category_file.close() # TODO: end a new category file diff --git a/hacking/templates/rst.j2 b/hacking/templates/rst.j2 index 5d292aaa50..d1da34b77c 100644 --- a/hacking/templates/rst.j2 +++ b/hacking/templates/rst.j2 @@ -168,9 +168,11 @@ Notes {% endfor %} {% endif %} - {% if not deprecated %} - {% if core %} +Module Status: @{ ','.join(metadata.status) }@ +-------------------- + + {% if metadata.supported_by == 'core' %} This is a Core Module --------------------- @@ -179,7 +181,7 @@ For more information on what this means please read :doc:`modules_core` {% else %} -This is an Extras Module +This is module is supported by: @{ metadata.supported_by }@ ------------------------ For more information on what this means please read :doc:`modules_extra` |