From 37e33106ae4b3077be6b7ae9b06aae3e220f0cdd Mon Sep 17 00:00:00 2001 From: Claude Becker Date: Sat, 22 May 2021 09:07:01 +0200 Subject: [PATCH] minimal patch to support ansible-core 2.11 Ansible no longer exposes the ssh connection plugin options as play_context attributes. Instead we fetch the values directly from the Ansible config system. See https://github.com/ansible/ansible/pull/73708 --- ansible_mitogen/loaders.py | 2 +- ansible_mitogen/transport_config.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ansible_mitogen/loaders.py b/ansible_mitogen/loaders.py index c00915d5..9fb50876 100644 --- a/ansible_mitogen/loaders.py +++ b/ansible_mitogen/loaders.py @@ -45,7 +45,7 @@ __all__ = [ import ansible ANSIBLE_VERSION_MIN = (2, 10) -ANSIBLE_VERSION_MAX = (2, 10) +ANSIBLE_VERSION_MAX = (2, 11) NEW_VERSION_MSG = ( "Your Ansible version (%s) is too recent. The most recent version\n" diff --git a/ansible_mitogen/transport_config.py b/ansible_mitogen/transport_config.py index 2a7a1e58..2d71c88b 100644 --- a/ansible_mitogen/transport_config.py +++ b/ansible_mitogen/transport_config.py @@ -451,7 +451,7 @@ class PlayContextSpec(Spec): return self._play_context.private_key_file def ssh_executable(self): - return self._play_context.ssh_executable + return C.config.get_config_value("ssh_executable", plugin_type="connection", plugin_name="ssh") def timeout(self): return self._play_context.timeout @@ -467,9 +467,9 @@ class PlayContextSpec(Spec): return [ mitogen.core.to_text(term) for s in ( - getattr(self._play_context, 'ssh_args', ''), - getattr(self._play_context, 'ssh_common_args', ''), - getattr(self._play_context, 'ssh_extra_args', '') + C.config.get_config_value("ssh_args", plugin_type="connection", plugin_name="ssh"), + C.config.get_config_value("ssh_common_args", plugin_type="connection", plugin_name="ssh"), + C.config.get_config_value("ssh_extra_args", plugin_type="connection", plugin_name="ssh") ) for term in ansible.utils.shlex.shlex_split(s or '') ]