From b69e5c55f4c506411a2201f5cd34b4eebfc856ae Mon Sep 17 00:00:00 2001 From: Nathaniel Case Date: Thu, 4 Jun 2020 15:42:43 -0400 Subject: [PATCH] Only show one deprecation warning if version and date are both defined. (#69808) This prefers date to version on the basis that date will have been added in 2.10, and version retained for 2.9 compatibility --- lib/ansible/module_utils/common/parameters.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ansible/module_utils/common/parameters.py b/lib/ansible/module_utils/common/parameters.py index 7a6a304b38e..b66d956f521 100644 --- a/lib/ansible/module_utils/common/parameters.py +++ b/lib/ansible/module_utils/common/parameters.py @@ -137,16 +137,16 @@ def list_deprecations(argument_spec, params, prefix=''): sub_prefix = '%s["%s"]' % (prefix, arg_name) else: sub_prefix = arg_name - if arg_opts.get('removed_in_version') is not None: - deprecations.append({ - 'msg': "Param '%s' is deprecated. See the module docs for more information" % sub_prefix, - 'version': arg_opts.get('removed_in_version') - }) if arg_opts.get('removed_at_date') is not None: deprecations.append({ 'msg': "Param '%s' is deprecated. See the module docs for more information" % sub_prefix, 'date': arg_opts.get('removed_at_date') }) + elif arg_opts.get('removed_in_version') is not None: + deprecations.append({ + 'msg': "Param '%s' is deprecated. See the module docs for more information" % sub_prefix, + 'version': arg_opts.get('removed_in_version') + }) # Check sub-argument spec sub_argument_spec = arg_opts.get('options') if sub_argument_spec is not None: