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
pull/69898/head
Nathaniel Case 5 years ago committed by GitHub
parent 66bd385f6f
commit b69e5c55f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -137,15 +137,15 @@ def list_deprecations(argument_spec, params, prefix=''):
sub_prefix = '%s["%s"]' % (prefix, arg_name) sub_prefix = '%s["%s"]' % (prefix, arg_name)
else: else:
sub_prefix = arg_name sub_prefix = arg_name
if arg_opts.get('removed_in_version') is not None: if arg_opts.get('removed_at_date') is not None:
deprecations.append({ deprecations.append({
'msg': "Param '%s' is deprecated. See the module docs for more information" % sub_prefix, 'msg': "Param '%s' is deprecated. See the module docs for more information" % sub_prefix,
'version': arg_opts.get('removed_in_version') 'date': arg_opts.get('removed_at_date')
}) })
if arg_opts.get('removed_at_date') is not None: elif arg_opts.get('removed_in_version') is not None:
deprecations.append({ deprecations.append({
'msg': "Param '%s' is deprecated. See the module docs for more information" % sub_prefix, 'msg': "Param '%s' is deprecated. See the module docs for more information" % sub_prefix,
'date': arg_opts.get('removed_at_date') 'version': arg_opts.get('removed_in_version')
}) })
# Check sub-argument spec # Check sub-argument spec
sub_argument_spec = arg_opts.get('options') sub_argument_spec = arg_opts.get('options')

Loading…
Cancel
Save