Debian Codegraph @

lib/ansible/plugins/action/command.py

raw
1 # Copyright: (c) 2017, Ansible Project
2 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
3
4 from __future__ import annotations
5
6 from ansible.plugins.action import ActionBase
7 from ansible.utils.vars import merge_hash
8
9
10 class ActionModule(ActionBase):
11
12 def run(self, tmp=None, task_vars=None):
13 self._supports_async = True
14 results = super(ActionModule, self).run(tmp, task_vars)
15 del tmp # tmp no longer has any effect
16
17 wrap_async = self._task.async_val
18 # explicitly call `ansible.legacy.command` for backcompat to allow library/ override of `command` while not allowing
19 # collections search for an unqualified `command` module
20 results = merge_hash(results, self._execute_module(module_name='ansible.legacy.command', task_vars=task_vars, wrap_async=wrap_async))
21
22 if not wrap_async:
23 # remove a temporary path we created
24 self._remove_tmp_path(self._connection._shell.tmpdir)
25
26 return results