now docs handle deprecated modules but still ignore aliases

This commit is contained in:
Brian Coca 2014-10-30 13:29:54 -04:00
parent 27d741102c
commit 8b5b97d066
2 changed files with 17 additions and 2 deletions

View file

@ -202,17 +202,23 @@ def process_module(module, options, env, template, outputname, module_map):
fname = module_map[module] fname = module_map[module]
basename = os.path.basename(fname)
deprecated = False
# ignore files with extensions # ignore files with extensions
if not os.path.basename(fname).endswith(".py"): if not basename.endswith(".py"):
return return
elif basename.startswith("_"):
if os.path.islink(fname): # alias
return
deprecated = True
# use ansible core library to parse out doc metadata YAML and plaintext examples # use ansible core library to parse out doc metadata YAML and plaintext examples
doc, examples = ansible.utils.module_docs.get_docstring(fname, verbose=options.verbose) doc, examples = ansible.utils.module_docs.get_docstring(fname, verbose=options.verbose)
# crash if module is missing documentation and not explicitly hidden from docs index # crash if module is missing documentation and not explicitly hidden from docs index
if doc is None and module not in ansible.utils.module_docs.BLACKLIST_MODULES: if doc is None and module not in ansible.utils.module_docs.BLACKLIST_MODULES:
sys.stderr.write("*** ERROR: CORE MODULE MISSING DOCUMENTATION: %s, %s ***\n" % (fname, module)) sys.stderr.write("*** ERROR: MODULE MISSING DOCUMENTATION: %s, %s ***\n" % (fname, module))
sys.exit(1) sys.exit(1)
if doc is None: if doc is None:
@ -254,6 +260,8 @@ def process_module(module, options, env, template, outputname, module_map):
doc['now_date'] = datetime.date.today().strftime('%Y-%m-%d') doc['now_date'] = datetime.date.today().strftime('%Y-%m-%d')
doc['ansible_version'] = options.ansible_version doc['ansible_version'] = options.ansible_version
doc['plainexamples'] = examples #plain text doc['plainexamples'] = examples #plain text
if deprecated and 'deprecated' not in doc:
doc['deprecated'] = "This module is deprecated, as such it's use is discouraged."
# here is where we build the table of contents... # here is where we build the table of contents...

View file

@ -21,6 +21,13 @@
# #
--------------------------------------------#} --------------------------------------------#}
{% if deprecated is defined -%}
DEPRECATED
----------
@{ deprecated }@
{% endif %}
Synopsis Synopsis
-------- --------