diff options
author | Matt Clay <matt@mystile.com> | 2022-06-08 10:07:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-08 12:07:28 -0500 |
commit | 2cc9333e9733f43a6269c9fa58ea2e18246a12aa (patch) | |
tree | a039cdacc3506558561baa64b8b9d9ae4b8d8510 | |
parent | daf160bc67d740db406c956114f5fbe6bdb8c467 (diff) | |
download | ansible-2cc9333e9733f43a6269c9fa58ea2e18246a12aa.tar.gz |
[stable-2.12] Make fuzzy plugin matching deterministic. (#77998)
(cherry picked from commit 5a0b230e240664ea4b316fe1592ce84003c9946c)
Co-authored-by: Matt Clay <matt@mystile.com>
-rw-r--r-- | changelogs/fragments/plugin-loader-deterministic-fuzzy-match.yml | 2 | ||||
-rw-r--r-- | lib/ansible/plugins/loader.py | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/changelogs/fragments/plugin-loader-deterministic-fuzzy-match.yml b/changelogs/fragments/plugin-loader-deterministic-fuzzy-match.yml new file mode 100644 index 0000000000..0cbd977d91 --- /dev/null +++ b/changelogs/fragments/plugin-loader-deterministic-fuzzy-match.yml @@ -0,0 +1,2 @@ +bugfixes: + - plugin loader - Sort results when fuzzy matching plugin names (https://github.com/ansible/ansible/issues/77966). diff --git a/lib/ansible/plugins/loader.py b/lib/ansible/plugins/loader.py index 25eee2f398..84193d2fda 100644 --- a/lib/ansible/plugins/loader.py +++ b/lib/ansible/plugins/loader.py @@ -546,6 +546,8 @@ class PluginLoader: if not found_files: 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: # TODO: warn? pass |