summaryrefslogtreecommitdiff
path: root/hacking
diff options
context:
space:
mode:
authorFelix Fontein <felix@fontein.de>2020-06-11 20:03:43 +0200
committerGitHub <noreply@github.com>2020-06-11 11:03:43 -0700
commit8d93ba91208ca5a0d2919acb1a5697e71f64d2f9 (patch)
treea649dbeee8a3e689490085e79c249bc7a513564c /hacking
parentf509a22f9d1ec4ef9ca265f35bbf05fac981e680 (diff)
downloadansible-8d93ba91208ca5a0d2919acb1a5697e71f64d2f9.tar.gz
Plugin/module docs: parse return values, add collection names in them (version_added_collection), and format them nicely in ansible-doc (#69796)
* Tag return value docs if they are a dict (and not str/None). * Try to parse return docs as YAML. * Properly dump return values in ansible-doc. * Adjust plugin formatter. * Add changelog fragment. * Don't add 'default' for return values. * Fix plugin_formatter. * Only try to parse return docs if they are still a string. * Add tests. * Warn if RETURN cannot be parsed. * Adjust tests. Also test for warning. * if -> elif (otherwise EXAMPLE will be parsed too). * Always parse return documentation, and fail if it is invalid YAML. * Polishing. * Mostly re-enable ansible-doc tests. Listing from the local collection seems to be somewhat broken. I assume this is why the test was disabled. * Lint and make tests work with Python 2. * Keep FQCNs in plugins (not modules), i.e. restore previous state.
Diffstat (limited to 'hacking')
-rw-r--r--hacking/build_library/build_ansible/command_plugins/plugin_formatter.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/hacking/build_library/build_ansible/command_plugins/plugin_formatter.py b/hacking/build_library/build_ansible/command_plugins/plugin_formatter.py
index e6cb3913db..475d86d97c 100644
--- a/hacking/build_library/build_ansible/command_plugins/plugin_formatter.py
+++ b/hacking/build_library/build_ansible/command_plugins/plugin_formatter.py
@@ -527,12 +527,8 @@ def process_plugins(module_map, templates, outputname, output_dir, ansible_versi
display.vvvvv(pp.pformat(module_map[module]))
if module_map[module]['returndocs']:
- try:
- doc['returndocs'] = yaml.safe_load(module_map[module]['returndocs'])
- process_returndocs(doc['returndocs'])
- except Exception as e:
- print("%s:%s:yaml error:%s:returndocs=%s" % (fname, module, e, module_map[module]['returndocs']))
- doc['returndocs'] = None
+ doc['returndocs'] = module_map[module]['returndocs']
+ process_returndocs(doc['returndocs'])
else:
doc['returndocs'] = None