Attributes compat (#75563) (#75621)

* ignore 'attributes' for json dump

  let existing overrides display, wont be full info but still pertinent info
  though user will have to check newer versions

(cherry picked from commit 463cf9fe24)
pull/75707/head
Brian Coca 3 years ago committed by GitHub
parent 5bc16fcc15
commit 12c4661bbb
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.

@ -71,6 +71,7 @@ class DocCLI(CLI):
# 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)
@ -262,8 +263,13 @@ class DocCLI(CLI):
plugin_docs[plugin] = DocCLI._combine_plugin_doc(plugin, plugin_type, doc, plainexamples, returndocs, metadata)
if do_json:
for entry in plugin_docs.keys():
for forbid in DocCLI.JSON_IGNORE:
try:
del plugin_docs[entry]['doc'][forbid]
except (KeyError, TypeError):
pass
jdump(plugin_docs)
else:
# Some changes to how plain text docs are formatted
text = []
@ -278,7 +284,6 @@ class DocCLI(CLI):
if text:
DocCLI.pager(''.join(text))
return 0
@staticmethod

@ -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: {}
'''

@ -448,6 +448,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