From 4d245c9a870bc04e7e0e4d47b2ef3cc2d94fe36d Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Mon, 7 May 2018 10:02:18 -0500 Subject: [PATCH] Backport #39764 for 2.5 - async_status environment (#39766) * Make sure that the implicit async_status gets the env from a task with async. Fixes #39699 (#39764) (cherry picked from commit 3b496db4d832e22d13cc89e06d9f036b32213cc6) * Add changelog for #39764 --- changelogs/fragments/async_status_env.yaml | 2 ++ lib/ansible/executor/task_executor.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/async_status_env.yaml diff --git a/changelogs/fragments/async_status_env.yaml b/changelogs/fragments/async_status_env.yaml new file mode 100644 index 00000000000..42f163437f4 --- /dev/null +++ b/changelogs/fragments/async_status_env.yaml @@ -0,0 +1,2 @@ +bugfixes: +- async - Ensure that the implicit async_status gets the env from a task with async (https://github.com/ansible/ansible/pull/39764) diff --git a/lib/ansible/executor/task_executor.py b/lib/ansible/executor/task_executor.py index 642e05c51d5..577792eb965 100644 --- a/lib/ansible/executor/task_executor.py +++ b/lib/ansible/executor/task_executor.py @@ -703,7 +703,7 @@ class TaskExecutor: # that (with a sleep for "poll" seconds between each retry) until the # async time limit is exceeded. - async_task = Task().load(dict(action='async_status jid=%s' % async_jid)) + async_task = Task().load(dict(action='async_status jid=%s' % async_jid, environment=self._task.environment)) # FIXME: this is no longer the case, normal takes care of all, see if this can just be generalized # Because this is an async task, the action handler is async. However,