diff options
author | James E. Blair <jim@acmegating.com> | 2022-03-30 13:26:56 -0700 |
---|---|---|
committer | James E. Blair <jim@acmegating.com> | 2022-03-30 13:35:02 -0700 |
commit | 08348143f5c438547b3b4b73f6af7ff7e753e013 (patch) | |
tree | 6e369de1eb20a4c3345dd308152032aef9b42ab5 | |
parent | b2c9334efcc506dd7566dab6cce014e46826807e (diff) | |
download | zuul-08348143f5c438547b3b4b73f6af7ff7e753e013.tar.gz |
Fix module loading for Windows jobs5.2.2
The recent security fix that caused loading ansible.bultin.command
to load the normal command module was a little too aggressive since
the same mechanism is used by Ansible to load Windows powershell
support code, which is under the Ansible.ModuleUtils.* hierarchy.
This would result in an error from Ansible when attempting to run
the setup playbook:
Could not find imported module support code for 'Ansible.ModuleUtils.Legacy'"'
This is corrected by reducing the scope of the mutation to just
ansible.builtin and ansible.legacy.
Change-Id: I70e9481478a3326692cb848ce0782f5331dc4758
-rw-r--r-- | releasenotes/notes/520-windows-7737f20c23b0afee.yaml | 7 | ||||
-rw-r--r-- | zuul/ansible/base/callback/zuul_json.py | 8 |
2 files changed, 13 insertions, 2 deletions
diff --git a/releasenotes/notes/520-windows-7737f20c23b0afee.yaml b/releasenotes/notes/520-windows-7737f20c23b0afee.yaml new file mode 100644 index 000000000..2a50111a3 --- /dev/null +++ b/releasenotes/notes/520-windows-7737f20c23b0afee.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + An issue introduced in Zuul version 5.2.0 which could cause jobs + running on Windows nodes to fail with the error `Could not find + imported module support code for 'Ansible.ModuleUtils.Legacy'"` + has been corrected. diff --git a/zuul/ansible/base/callback/zuul_json.py b/zuul/ansible/base/callback/zuul_json.py index 6b8b957bb..1d7059871 100644 --- a/zuul/ansible/base/callback/zuul_json.py +++ b/zuul/ansible/base/callback/zuul_json.py @@ -220,13 +220,17 @@ orig_find_plugin = PluginLoader.find_plugin def mp_get(self, name, *args, **kwargs): - name = name.rsplit('.', 1)[-1] + if (name.startswith('ansible.builtin.') or + name.startswith('ansible.legacy.')): + name = name.rsplit('.', 1)[-1] ret = orig_get(self, name, *args, **kwargs) return ret def mp_find_plugin(self, name, *args, **kwargs): - name = name.rsplit('.', 1)[-1] + if (name.startswith('ansible.builtin.') or + name.startswith('ansible.legacy.')): + name = name.rsplit('.', 1)[-1] ret = orig_find_plugin(self, name, *args, **kwargs) return ret |