summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Coca <bcoca@users.noreply.github.com>2018-12-10 17:37:15 +0100
committerGitHub <noreply@github.com>2018-12-10 17:37:15 +0100
commit20270680fc61fc70ae1cdb27a5d8642d14549bfa (patch)
tree7b66bbf694bd56ac9bba429fcf039e59150e2f87
parentPull documentation of ansible.module_utils.basic from (improved) doc strings.... (diff)
downloadansible-20270680fc61fc70ae1cdb27a5d8642d14549bfa.tar.xz
ansible-20270680fc61fc70ae1cdb27a5d8642d14549bfa.zip
fixes to ansible-doc (#47682)
fixes to ansible-doc - change json to always be type dependent - change changelog generation to loop over the options - warn about ignoring module path
-rw-r--r--changelogs/fragments/docfixes.yml2
-rw-r--r--lib/ansible/cli/doc.py18
-rwxr-xr-xpackaging/release/changelogs/changelog.py6
3 files changed, 16 insertions, 10 deletions
diff --git a/changelogs/fragments/docfixes.yml b/changelogs/fragments/docfixes.yml
new file mode 100644
index 0000000000..e1b71609ba
--- /dev/null
+++ b/changelogs/fragments/docfixes.yml
@@ -0,0 +1,2 @@
+bugfixes:
+ - "ansible-doc, --json now is 'type intelligent' and reinstated --all option"
diff --git a/lib/ansible/cli/doc.py b/lib/ansible/cli/doc.py
index b911a6a801..256c68779f 100644
--- a/lib/ansible/cli/doc.py
+++ b/lib/ansible/cli/doc.py
@@ -127,18 +127,18 @@ class DocCLI(CLI):
# process all plugins of type
if self.options.all_plugins:
- self.args = self.get_all_plugins_of_type(plugin_type, loader)
+ self.args = self.get_all_plugins_of_type(plugin_type)
+ if self.options.module_path:
+ display.warning('Ignoring "--module-path/-M" option as "--all/-a" only displays builtins')
- # dump plugin metadata as JSON
+ # dump plugin desc/metadata as JSON
if self.options.json_dump:
plugin_data = {}
- for plugin_type in C.DOCUMENTABLE_PLUGINS:
- plugin_data[plugin_type] = dict()
- plugin_names = self.get_all_plugins_of_type(plugin_type)
- for plugin_name in plugin_names:
- plugin_info = self.get_plugin_metadata(plugin_type, plugin_name)
- if plugin_info is not None:
- plugin_data[plugin_type][plugin_name] = plugin_info
+ plugin_names = self.get_all_plugins_of_type(plugin_type)
+ for plugin_name in plugin_names:
+ plugin_info = self.get_plugin_metadata(plugin_type, plugin_name)
+ if plugin_info is not None:
+ plugin_data[plugin_name] = plugin_info
self.pager(json.dumps(plugin_data, sort_keys=True, indent=4))
diff --git a/packaging/release/changelogs/changelog.py b/packaging/release/changelogs/changelog.py
index c11ceab222..dcaedbb7b1 100755
--- a/packaging/release/changelogs/changelog.py
+++ b/packaging/release/changelogs/changelog.py
@@ -24,6 +24,8 @@ try:
except ImportError:
argcomplete = None
+from ansible import constants as C
+
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
CHANGELOG_DIR = os.path.join(BASE_DIR, 'changelogs')
CONFIG_PATH = os.path.join(CHANGELOG_DIR, 'config.yaml')
@@ -173,7 +175,9 @@ def load_plugins(version, force_reload):
LOGGER.info('refreshing plugin cache')
plugins_data['version'] = version
- plugins_data['plugins'] = json.loads(subprocess.check_output([os.path.join(BASE_DIR, 'bin', 'ansible-doc'), '--json']))
+ for plugin_type in C.DOCUMENTABLE_PLUGINS:
+ plugins_data['plugins'][plugin_type] = json.loads(subprocess.check_output([os.path.join(BASE_DIR, 'bin', 'ansible-doc'),
+ '--json', '-t', plugin_type]))
# remove empty namespaces from plugins
for section in plugins_data['plugins'].values():