From b6d1df749cb1ec06b83d61ea44a9d5cc7171d96c Mon Sep 17 00:00:00 2001 From: David Wilson Date: Tue, 20 Aug 2019 13:59:01 +0100 Subject: [PATCH] issue #633: take inventory_hostname from task_vars It used to be set by on_action_run() from task_vars, but this doesn't work for meta: reset_connection. That meant MITOGEN_CPU_COUNT>1 would pick the wrong mux to reset the connection on. --- ansible_mitogen/connection.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ansible_mitogen/connection.py b/ansible_mitogen/connection.py index 2dd3bfa9..5e0e28b8 100644 --- a/ansible_mitogen/connection.py +++ b/ansible_mitogen/connection.py @@ -486,9 +486,6 @@ class Connection(ansible.plugins.connection.ConnectionBase): # the case of the synchronize module. # - #: Set to the host name as it appears in inventory by on_action_run(). - inventory_hostname = None - #: Set to task_vars by on_action_run(). _task_vars = None @@ -527,7 +524,6 @@ class Connection(ansible.plugins.connection.ConnectionBase): :param str loader_basedir: Loader base directory; see :attr:`loader_basedir`. """ - self.inventory_hostname = task_vars['inventory_hostname'] self._task_vars = task_vars self.host_vars = task_vars['hostvars'] self.delegate_to_hostname = delegate_to_hostname @@ -712,7 +708,7 @@ class Connection(ansible.plugins.connection.ConnectionBase): connection=self, play_context=self._play_context, transport=self.transport, - inventory_name=self.inventory_hostname, + inventory_name=self.get_task_var('inventory_hostname'), ) stack = self._stack_from_spec(spec) return spec.inventory_name(), stack