mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Powershell module_utils loader and tests (#26932)
* supports custom module_utils loads (anything in module prefaced with `#Requires -Module Ansible.ModuleUtils.*`) * supports all usual PluginLoader module_utils locations (built-in lib/ansible/module_utils/, custom path from config, playbook module_utils/, ~/.ansible/module_utils, role module_utils, etc), * moves Powershell module_utils from module_utils/powershell.ps1 to module_utils/powershell/Ansible.ModuleUtils.PowerShellLegacy.psm1
This commit is contained in:
parent
37e757286d
commit
907b662dc6
12 changed files with 84 additions and 7 deletions
33
test/integration/targets/win_module_utils/tasks/main.yml
Normal file
33
test/integration/targets/win_module_utils/tasks/main.yml
Normal file
|
@ -0,0 +1,33 @@
|
|||
- name: call old WANTS_JSON module
|
||||
legacy_only_old_way:
|
||||
register: old_way
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- old_way.data == 'success'
|
||||
|
||||
- name: call module with only legacy requires
|
||||
legacy_only_new_way:
|
||||
register: new_way
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- new_way.data == 'success'
|
||||
|
||||
- name: call module with local module_utils
|
||||
uses_local_utils:
|
||||
register: local_utils
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- local_utils.data == "ValueFromCustomFunction"
|
||||
|
||||
- name: call module that imports bogus Ansible-named module_utils
|
||||
uses_bogus_utils:
|
||||
ignore_errors: true
|
||||
register: bogus_utils
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- bogus_utils | failed
|
||||
- bogus_utils.msg | search("Could not find")
|
Loading…
Add table
Add a link
Reference in a new issue