diff --git a/docs/bin/plugin_formatter.py b/docs/bin/plugin_formatter.py index 03639b3c6d..b4eed26caf 100755 --- a/docs/bin/plugin_formatter.py +++ b/docs/bin/plugin_formatter.py @@ -51,6 +51,7 @@ from six import iteritems, string_types from ansible.errors import AnsibleError from ansible.module_utils._text import to_bytes, to_text from ansible.module_utils.common.collections import is_sequence +from ansible.module_utils.parsing.convert_bool import boolean from ansible.plugins.loader import fragment_loader from ansible.utils import plugin_docs from ansible.utils.display import Display @@ -159,6 +160,17 @@ def rst_xline(width, char="="): test_list = partial(is_sequence, include_strings=False) +def normalize_options(value): + """Normalize boolean option value.""" + + if value.get('type') == 'bool' and 'default' in value: + try: + value['default'] = boolean(value['default'], strict=True) + except TypeError: + pass + return value + + def write_data(text, output_dir, outputname, module=None): ''' dumps module output to a file or the screen, as requested ''' @@ -274,6 +286,16 @@ def get_plugin_info(module_dir, limit_to=None, verbose=False): # use ansible core library to parse out doc metadata YAML and plaintext examples doc, examples, returndocs, metadata = plugin_docs.get_docstring(module_path, fragment_loader, verbose=verbose) + if 'options' in doc and doc['options'] is None: + display.error("*** ERROR: DOCUMENTATION.options must be a dictionary/hash when used. ***") + pos = getattr(doc, "ansible_pos", None) + if pos is not None: + display.error("Module position: %s, %d, %d" % doc.ansible_pos) + doc['options'] = dict() + + for key, opt in doc.get('options', {}).items(): + doc['options'][key] = normalize_options(opt) + # save all the information module_info[module] = {'path': module_path, 'source': os.path.relpath(module_path, module_dir), diff --git a/lib/ansible/plugins/inventory/auto.py b/lib/ansible/plugins/inventory/auto.py index 4566e4403c..f444acee90 100644 --- a/lib/ansible/plugins/inventory/auto.py +++ b/lib/ansible/plugins/inventory/auto.py @@ -15,7 +15,6 @@ DOCUMENTATION = ''' C(plugin) key at its root will automatically cause the named plugin to be loaded and executed with that config. This effectively provides automatic whitelisting of all installed/accessible inventory plugins. - To disable this behavior, remove C(auto) from the C(INVENTORY_ENABLED) config element. - options: ''' EXAMPLES = '''