From f75e1698f59ac9f18a58a4d6e04aa9603994ba76 Mon Sep 17 00:00:00 2001 From: Nathaniel Case Date: Thu, 9 Apr 2020 18:15:40 -0400 Subject: [PATCH] [stable-2.9] Optionally support task_uuid if passed from newer modules (#68556) * Optionally support task_uuid if passed from newer modules * Add changelog --- changelogs/fragments/68556-start_conn-forward-compat.yaml | 3 +++ lib/ansible/executor/task_executor.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/68556-start_conn-forward-compat.yaml diff --git a/changelogs/fragments/68556-start_conn-forward-compat.yaml b/changelogs/fragments/68556-start_conn-forward-compat.yaml new file mode 100644 index 00000000000..9ddfacdb051 --- /dev/null +++ b/changelogs/fragments/68556-start_conn-forward-compat.yaml @@ -0,0 +1,3 @@ +bugfixes: +- Alter task_executor's start_connection to support newer modules from + collections which expect to send task UUID. diff --git a/lib/ansible/executor/task_executor.py b/lib/ansible/executor/task_executor.py index 8d7f035f0fa..5816b24cec5 100644 --- a/lib/ansible/executor/task_executor.py +++ b/lib/ansible/executor/task_executor.py @@ -1049,7 +1049,7 @@ class TaskExecutor: return handler -def start_connection(play_context, variables): +def start_connection(play_context, variables, task_uuid=None): ''' Starts the persistent connection ''' @@ -1080,7 +1080,7 @@ def start_connection(play_context, variables): python = sys.executable master, slave = pty.openpty() p = subprocess.Popen( - [python, ansible_connection, to_text(os.getppid())], + [python, ansible_connection, to_text(os.getppid()), to_text(task_uuid)], stdin=slave, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env ) os.close(slave)