Provide more info about plugin in deprecation message (#81719)

Provide more information about plugin usage which needs to be
used instead of the deprecated plugin in the deprecation message.

Fixes: #80561

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/81817/head
Abhijeet Kasurde 8 months ago committed by GitHub
parent 27bbff7c22
commit 4d4c50f856
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,3 @@
---
bugfixes:
- Provide additional information about the alternative plugin in the deprecation message (https://github.com/ansible/ansible/issues/80561).

@ -1173,24 +1173,22 @@ class Jinja2Loader(PluginLoader):
# check deprecations
deprecation_entry = routing_entry.get('deprecation')
if deprecation_entry:
warning_text = deprecation_entry.get('warning_text')
warning_text = deprecation_entry.get('warning_text') or ''
removal_date = deprecation_entry.get('removal_date')
removal_version = deprecation_entry.get('removal_version')
if not warning_text:
warning_text = '{0} "{1}" is deprecated'.format(self.type, key)
warning_text = f'{self.type.title()} "{key}" has been deprecated.{" " if warning_text else ""}{warning_text}'
display.deprecated(warning_text, version=removal_version, date=removal_date, collection_name=acr.collection)
# check removal
tombstone_entry = routing_entry.get('tombstone')
if tombstone_entry:
warning_text = tombstone_entry.get('warning_text')
warning_text = tombstone_entry.get('warning_text') or ''
removal_date = tombstone_entry.get('removal_date')
removal_version = tombstone_entry.get('removal_version')
if not warning_text:
warning_text = '{0} "{1}" has been removed'.format(self.type, key)
warning_text = f'{self.type.title()} "{key}" has been removed.{" " if warning_text else ""}{warning_text}'
exc_msg = display.get_deprecation_message(warning_text, version=removal_version, date=removal_date,
collection_name=acr.collection, removed=True)

@ -72,8 +72,11 @@ cat out.txt
test "$(grep out.txt -ce 'deprecation1' -ce 'deprecation2' -ce 'deprecation3')" == 3
grep out.txt -e 'redirecting (type: filter) testns.testredirect.multi_redirect_filter to testns.testredirect.redirect_filter1'
grep out.txt -e 'Filter "testns.testredirect.multi_redirect_filter"'
grep out.txt -e 'redirecting (type: filter) testns.testredirect.redirect_filter1 to testns.testredirect.redirect_filter2'
grep out.txt -e 'Filter "testns.testredirect.redirect_filter1"'
grep out.txt -e 'redirecting (type: filter) testns.testredirect.redirect_filter2 to testns.testcoll.testfilter'
grep out.txt -e 'Filter "testns.testredirect.redirect_filter2"'
echo "--- validating collections support in playbooks/roles"
# run test playbooks

Loading…
Cancel
Save