From 68386428e3a3d2b5eaa875cd1b56c0e2ae07d957 Mon Sep 17 00:00:00 2001 From: Claude Becker Date: Sun, 6 Jun 2021 15:00:01 +0200 Subject: [PATCH] single call to task_vars and handle missing key --- ansible_mitogen/transport_config.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ansible_mitogen/transport_config.py b/ansible_mitogen/transport_config.py index 138d0951..9bea4ee7 100644 --- a/ansible_mitogen/transport_config.py +++ b/ansible_mitogen/transport_config.py @@ -464,6 +464,7 @@ class PlayContextSpec(Spec): ) def ssh_args(self): + variables = self._task_vars["vars"].get("vars", {}) return [ mitogen.core.to_text(term) for s in ( @@ -471,19 +472,19 @@ class PlayContextSpec(Spec): "ssh_args", plugin_type="connection", plugin_name="ssh", - variables=self._task_vars["vars"]["vars"], + variables=variables, ), C.config.get_config_value( "ssh_common_args", plugin_type="connection", plugin_name="ssh", - variables=self._task_vars["vars"]["vars"], + variables=variables, ), C.config.get_config_value( "ssh_extra_args", plugin_type="connection", plugin_name="ssh", - variables=self._task_vars["vars"]["vars"], + variables=variables, ), ) for term in ansible.utils.shlex.shlex_split(s or '')