diff --git a/lib/ansible/plugins/action/__init__.py b/lib/ansible/plugins/action/__init__.py index d1b034d763d..40fdd670fcf 100644 --- a/lib/ansible/plugins/action/__init__.py +++ b/lib/ansible/plugins/action/__init__.py @@ -165,14 +165,21 @@ class ActionBase(with_metaclass(ABCMeta, object)): # Check to determine if PowerShell modules are supported, and apply # some fixes (hacks) to module name + args. if mod_type == '.ps1': - # win_stat, win_file, and win_copy are not just like their + # FIXME: This should be temporary and moved to an exec subsystem plugin where we can define the mapping + # for each subsystem. + win_collection = 'ansible.windows' + + # async_status, win_stat, win_file, win_copy, and win_ping are not just like their # python counterparts but they are compatible enough for our # internal usage - if module_name in ('stat', 'file', 'copy') and self._task.action != module_name: - module_name = 'win_%s' % module_name + if module_name in ('stat', 'file', 'copy', 'ping') and self._task.action != module_name: + module_name = '%s.win_%s' % (win_collection, module_name) + elif module_name in ['async_status']: + module_name = '%s.%s' % (win_collection, module_name) # Remove extra quotes surrounding path parameters before sending to module. - if module_name in ('win_stat', 'win_file', 'win_copy', 'slurp') and module_args and hasattr(self._connection._shell, '_unquote'): + if module_name.split('.')[-1] in ['win_stat', 'win_file', 'win_copy', 'slurp'] and module_args and \ + hasattr(self._connection._shell, '_unquote'): for key in ('src', 'dest', 'path'): if key in module_args: module_args[key] = self._connection._shell._unquote(module_args[key]) diff --git a/lib/ansible/plugins/action/wait_for_connection.py b/lib/ansible/plugins/action/wait_for_connection.py index 8c5b3bea1a8..a9fbd45fc91 100644 --- a/lib/ansible/plugins/action/wait_for_connection.py +++ b/lib/ansible/plugins/action/wait_for_connection.py @@ -88,11 +88,7 @@ class ActionModule(ActionBase): except AttributeError: pass - # Use win_ping on winrm/powershell, else use ping - if getattr(self._connection._shell, "_IS_WINDOWS", False): - ping_result = self._execute_module(module_name='win_ping', module_args=dict(), task_vars=task_vars) - else: - ping_result = self._execute_module(module_name='ping', module_args=dict(), task_vars=task_vars) + ping_result = self._execute_module(module_name='ping', module_args=dict(), task_vars=task_vars) # Test module output if ping_result['ping'] != 'pong': diff --git a/test/lib/ansible_test/_data/playbooks/windows_coverage_teardown.yml b/test/lib/ansible_test/_data/playbooks/windows_coverage_teardown.yml index 85ddfa42143..ab34dc27706 100644 --- a/test/lib/ansible_test/_data/playbooks/windows_coverage_teardown.yml +++ b/test/lib/ansible_test/_data/playbooks/windows_coverage_teardown.yml @@ -2,10 +2,6 @@ - name: collect the coverage files from the Windows host hosts: windows gather_facts: no - # The collections keyword is required to allow fetch to work. - # See: https://github.com/ansible/ansible/issues/68269 - collections: - - ansible.windows tasks: - name: make sure all vars have been set assert: diff --git a/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/modules/async_status.ps1 b/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/modules/async_status.ps1 new file mode 120000 index 00000000000..6fc438d6c88 --- /dev/null +++ b/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/modules/async_status.ps1 @@ -0,0 +1 @@ +../../../../../../plugins/modules/async_status.ps1 \ No newline at end of file diff --git a/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/modules/win_copy.ps1 b/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/modules/win_copy.ps1 new file mode 120000 index 00000000000..a34fb012843 --- /dev/null +++ b/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/modules/win_copy.ps1 @@ -0,0 +1 @@ +../../../../../../plugins/modules/win_copy.ps1 \ No newline at end of file diff --git a/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/modules/win_copy.py b/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/modules/win_copy.py new file mode 120000 index 00000000000..2d2c69a214c --- /dev/null +++ b/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/modules/win_copy.py @@ -0,0 +1 @@ +../../../../../../plugins/modules/win_copy.py \ No newline at end of file diff --git a/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/modules/win_stat.ps1 b/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/modules/win_stat.ps1 new file mode 120000 index 00000000000..62a7a40a0eb --- /dev/null +++ b/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/modules/win_stat.ps1 @@ -0,0 +1 @@ +../../../../../../plugins/modules/win_stat.ps1 \ No newline at end of file diff --git a/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/modules/win_stat.py b/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/modules/win_stat.py new file mode 120000 index 00000000000..1db4c95e4ab --- /dev/null +++ b/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/modules/win_stat.py @@ -0,0 +1 @@ +../../../../../../plugins/modules/win_stat.py \ No newline at end of file