From 6900e88dfdf4e77d4800dae8b48bf82e9b7ad419 Mon Sep 17 00:00:00 2001 From: Alex Willmer Date: Tue, 10 Dec 2024 16:15:06 +0000 Subject: [PATCH] ansible_mitogen: Fix templated python interpreter with `meta: reset_connection` refs #1079 --- ansible_mitogen/connection.py | 6 +++--- docs/changelog.rst | 2 ++ .../issue_1079__wait_for_connection_timeout.yml | 12 ++++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/ansible_mitogen/connection.py b/ansible_mitogen/connection.py index 90ddb7ed..a043ef1d 100644 --- a/ansible_mitogen/connection.py +++ b/ansible_mitogen/connection.py @@ -948,11 +948,11 @@ class Connection(ansible.plugins.connection.ConnectionBase): # have an action object, which we need for interpreter_discovery. # Create a temporary action object for this purpose. self._action = ansible_mitogen.mixins.ActionModuleMixin( - task=0, + task=task, connection=self, play_context=self._play_context, - loader=0, - templar=0, + loader=templar._loader, + templar=templar, shared_loader_obj=0, ) self._action_monkey_patched_by_mitogen = True diff --git a/docs/changelog.rst b/docs/changelog.rst index 0b83a04c..9add8ba0 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -23,6 +23,8 @@ In progress (unreleased) * :gh:issue:`1079` :mod:`ansible_mitogen`: Fix :ans:mod:`wait_for_connection` timeout with templated ``ansible_python_interpreter`` +* :gh:issue:`1079` :mod:`ansible_mitogen`: Fix templated python interpreter + with `meta: reset_connection` v0.3.19 (2024-12-02) diff --git a/tests/ansible/regression/issue_1079__wait_for_connection_timeout.yml b/tests/ansible/regression/issue_1079__wait_for_connection_timeout.yml index 2ff1899b..6ded03ea 100644 --- a/tests/ansible/regression/issue_1079__wait_for_connection_timeout.yml +++ b/tests/ansible/regression/issue_1079__wait_for_connection_timeout.yml @@ -8,3 +8,15 @@ tags: - issue_1079 - wait_for_connection + +- hosts: issue1079 + gather_facts: false + tasks: + - meta: reset_connection + - name: Wait for connection after reset_connection + wait_for_connection: + timeout: 5 + tags: + - issue_1079 + - reset_connection + - wait_for_connection