From 3633e2178000d87ab8c3d6571b5860bcff11454a Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Fri, 26 Oct 2018 12:16:26 -0500 Subject: Add missing self._supports_async to uri action plugin (#47677) * Add missing self._supports_async to uri action plugin. Fixes #47660 * Additional changes needed to support async * Missed a call to execute_module --- changelogs/fragments/uri-supports-async.yaml | 2 ++ lib/ansible/plugins/action/uri.py | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/uri-supports-async.yaml diff --git a/changelogs/fragments/uri-supports-async.yaml b/changelogs/fragments/uri-supports-async.yaml new file mode 100644 index 0000000000..ff9e8eb20d --- /dev/null +++ b/changelogs/fragments/uri-supports-async.yaml @@ -0,0 +1,2 @@ +bugfixes: +- uri - Ensure the ``uri`` module supports async (https://github.com/ansible/ansible/issues/47660) diff --git a/lib/ansible/plugins/action/uri.py b/lib/ansible/plugins/action/uri.py index 0eea66e7a6..63280e7881 100644 --- a/lib/ansible/plugins/action/uri.py +++ b/lib/ansible/plugins/action/uri.py @@ -20,6 +20,8 @@ class ActionModule(ActionBase): TRANSFERS_FILES = True def run(self, tmp=None, task_vars=None): + self._supports_async = True + if task_vars is None: task_vars = dict() @@ -33,7 +35,7 @@ class ActionModule(ActionBase): if (src and remote_src) or not src: # everything is remote, so we just execute the module # without changing any of the module arguments - raise _AnsibleActionDone(result=self._execute_module(task_vars=task_vars)) + raise _AnsibleActionDone(result=self._execute_module(task_vars=task_vars, wrap_async=self._task.async_val)) try: src = self._find_needle('files', src) @@ -51,9 +53,10 @@ class ActionModule(ActionBase): ) ) - result.update(self._execute_module('uri', module_args=new_module_args, task_vars=task_vars)) + result.update(self._execute_module('uri', module_args=new_module_args, task_vars=task_vars, wrap_async=self._task.async_val)) except AnsibleAction as e: result.update(e.result) finally: - self._remove_tmp_path(self._connection._shell.tmpdir) + if not self._task.async_val: + self._remove_tmp_path(self._connection._shell.tmpdir) return result -- cgit v1.2.1