[stable-2.13] Make fuzzy plugin matching deterministic. (#77997)

(cherry picked from commit 5a0b230e24)

Co-authored-by: Matt Clay <matt@mystile.com>
pull/78006/head
Matt Clay 2 years ago committed by GitHub
parent 567a295c00
commit 6291280ef8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- plugin loader - Sort results when fuzzy matching plugin names (https://github.com/ansible/ansible/issues/77966).

@ -533,6 +533,8 @@ class PluginLoader:
if not found_files: if not found_files:
return plugin_load_context.nope('failed fuzzy extension match for {0} in {1}'.format(full_name, acr.collection)) return plugin_load_context.nope('failed fuzzy extension match for {0} in {1}'.format(full_name, acr.collection))
found_files = sorted(found_files) # sort to ensure deterministic results, with the shortest match first
if len(found_files) > 1: if len(found_files) > 1:
# TODO: warn? # TODO: warn?
pass pass

Loading…
Cancel
Save