Attributes compat (#75563)

* ignore attributes in output

* ignore 'attributes' for json dump

* actually add file

* clog

* sometimtes its not a dict

* always ignore

* also allow validation to work on newer modules

* remove attributes doc

  let existing overrides display, wont be full info but still pertinent info
  though user will have to check newer versions
pull/75623/head
Brian Coca 3 years ago committed by GitHub
parent 8c105c0f61
commit 463cf9fe24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- make previous versions compatible we new attributres w/o implementing them.

@ -334,6 +334,7 @@ class DocCLI(CLI, RoleMixin):
# default ignore list for detailed views
IGNORE = ('module', 'docuri', 'version_added', 'short_description', 'now_date', 'plainexamples', 'returndocs', 'collection')
JSON_IGNORE = ('attributes',)
# Warning: If you add more elements here, you also need to add it to the docsite build (in the
# ansible-community/antsibull repo)
@ -686,6 +687,12 @@ class DocCLI(CLI, RoleMixin):
docs = self._get_plugins_docs(plugin_type, loader)
if do_json:
for entry in docs.keys():
for forbid in DocCLI.JSON_IGNORE:
try:
del docs[entry]['doc'][forbid]
except (KeyError, TypeError):
pass
jdump(docs)
else:
text = []

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
# NOTE: this file is here to allow modules using the new attributes feature to
# work w/o errors in this version of ansible, it does NOT provide the full
# attributes feature, just a shim to avoid the fragment not being found.
class ModuleDocFragment(object):
# Standard documentation fragment
DOCUMENTATION = r'''
options: {}
'''

@ -505,6 +505,7 @@ def doc_schema(module_name, for_collection=False, deprecated_module=False):
'options': Any(None, *list_dict_option_schema(for_collection)),
'extends_documentation_fragment': Any(list_string_types, *string_types),
'version_added_collection': collection_name,
'attributes': object,
}
if for_collection:

Loading…
Cancel
Save