Always mention the name of the deprecated plugin in routing deprecation messages (#73059)

This commit is contained in:
Felix Fontein 2021-01-14 17:45:02 +01:00 committed by GitHub
parent df451636e7
commit df9cf368c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- "Always mention the name of the deprecated or tombstoned plugin in routing deprecation/tombstone messages (https://github.com/ansible/ansible/pull/73059)."

View file

@ -134,14 +134,15 @@ class PluginLoadContext(object):
if not deprecation:
return self
warning_text = deprecation.get('warning_text', None)
# The `or ''` instead of using `.get(..., '')` makes sure that even if the user explicitly
# sets `warning_text` to `~` (None) or `false`, we still get an empty string.
warning_text = deprecation.get('warning_text', None) or ''
removal_date = deprecation.get('removal_date', None)
removal_version = deprecation.get('removal_version', None)
# If both removal_date and removal_version are specified, use removal_date
if removal_date is not None:
removal_version = None
if not warning_text:
warning_text = '{0} has been deprecated'.format(name)
warning_text = '{0} has been deprecated.{1}{2}'.format(name, ' ' if warning_text else '', warning_text)
display.deprecated(warning_text, date=removal_date, version=removal_version, collection_name=collection_name)
@ -459,7 +460,8 @@ class PluginLoader:
if tombstone:
removal_date = tombstone.get('removal_date')
removal_version = tombstone.get('removal_version')
warning_text = tombstone.get('warning_text') or '{0} has been removed.'.format(fq_name)
warning_text = tombstone.get('warning_text') or ''
warning_text = '{0} has been removed.{1}{2}'.format(fq_name, ' ' if warning_text else '', warning_text)
removed_msg = display.get_deprecation_message(msg=warning_text, version=removal_version,
date=removal_date, removed=True,
collection_name=acr.collection)