From 40429ee64e09ab43041f28e7904b593d1e282238 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Wed, 27 Nov 2013 21:34:00 -0500 Subject: [PATCH] Code to limit display of version_added attributions in modules for modules that are too old to call out this information. This does not generically apply to new arguments added to existing modules, just the version_added attribute on the top level modules. --- hacking/module_formatter.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/hacking/module_formatter.py b/hacking/module_formatter.py index 0e104d32e7..35fde1b1f6 100755 --- a/hacking/module_formatter.py +++ b/hacking/module_formatter.py @@ -34,6 +34,10 @@ import cgi import ansible.utils import ansible.utils.module_docs as module_docs +# if a module is added in a version of Ansible older than this, don't print the version added information +# in the module documentation because everyone is assumed to be running something newer than this already. +TO_OLD_TO_BE_NOTABLE = 1.0 + # Get parent directory of the directory this script lives in MODULEDIR=os.path.abspath(os.path.join( os.path.dirname(os.path.realpath(__file__)), os.pardir, 'library' @@ -366,8 +370,20 @@ def main(): if not 'version_added' in doc: sys.stderr.write("*** ERROR: missing version_added in: %s ***\n" % module) sys.exit(1) + + added = 0 if doc['version_added'] == 'historical': del doc['version_added'] + else: + added = doc['version_added'] + + # don't show version added information if it's too old to be called out + if added: + added_tokens = str(added).split(".") + added = added_tokens[0] + "." + added_tokens[1] + added_float = float(added) + if added and added_float < TO_OLD_TO_BE_NOTABLE: + del doc['version_added'] for (k,v) in doc['options'].iteritems(): all_keys.append(k)