JustinWayland 2 weeks ago committed by GitHub
commit 93b94cba07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,2 @@
deprecated_features:
- passing is_module to get_docstring - is deprecated in favor of passing ``plugin_type='module'`` in instead (https://github.com/ansible/ansible/pull/82192).

@ -515,7 +515,7 @@ class ConsoleCLI(CLI, cmd.Cmd):
def module_args(self, module_name):
in_path = module_loader.find_plugin(module_name)
oc, a, _dummy1, _dummy2 = plugin_docs.get_docstring(in_path, fragment_loader, is_module=True)
oc, a, _dummy1, _dummy2 = plugin_docs.get_docstring(in_path, fragment_loader, plugin_type='module')
return list(oc['options'].keys())
def run(self):

@ -14,6 +14,7 @@ from ansible.module_utils.common.text.converters import to_native
from ansible.parsing.plugin_docs import read_docstring
from ansible.parsing.yaml.loader import AnsibleLoader
from ansible.utils.display import Display
from ansible.utils.sentinel import Sentinel
display = Display()
@ -204,10 +205,14 @@ def add_fragments(doc, filename, fragment_loader, is_module=False):
raise AnsibleError('unknown doc_fragment(s) in file {0}: {1}'.format(filename, to_native(', '.join(unknown_fragments))))
def get_docstring(filename, fragment_loader, verbose=False, ignore_errors=False, collection_name=None, is_module=None, plugin_type=None):
def get_docstring(filename, fragment_loader, verbose=False, ignore_errors=False, collection_name=None, is_module=Sentinel, plugin_type=None):
"""
DOCUMENTATION can be extended using documentation fragments loaded by the PluginLoader from the doc_fragments plugins.
"""
if is_module is Sentinel:
is_module = None
else:
display.deprecated("is_module is deprecated, pass plugin_type='module' instead", version='2.19')
if is_module is None:
if plugin_type is None:
@ -215,7 +220,6 @@ def get_docstring(filename, fragment_loader, verbose=False, ignore_errors=False,
else:
is_module = (plugin_type == 'module')
else:
# TODO deprecate is_module argument, now that we have 'type'
pass
data = read_docstring(filename, verbose=verbose, ignore_errors=ignore_errors)

Loading…
Cancel
Save