more test cases pass

pull/658/head
Steven Robertson 5 years ago
parent e3eebb98d0
commit f10fb7d486

@ -503,6 +503,9 @@ class Connection(ansible.plugins.connection.ConnectionBase):
#: matching vanilla Ansible behaviour. #: matching vanilla Ansible behaviour.
loader_basedir = None loader_basedir = None
# set by `_get_task_vars()` for interpreter discovery
_action = None
def __del__(self): def __del__(self):
""" """
Ansible cannot be trusted to always call close() e.g. the synchronize Ansible cannot be trusted to always call close() e.g. the synchronize

@ -83,11 +83,11 @@ def run_interpreter_discovery_if_necessary(s, task_vars, action):
Triggers ansible python interpreter discovery if requested. Triggers ansible python interpreter discovery if requested.
Caches this value the same way Ansible does it. Caches this value the same way Ansible does it.
""" """
# special case where we've already called discover_interpreter which then # _finding_python_interpreter is a special case where we've already called discover_interpreter which then
# calls low_level_exec_command which then retriggers spec.python_path() # calls low_level_exec_command which then retriggers spec.python_path()
# in connect_ssh(), so we'll return the default '/usr/bin/python' to finish building the stack # in connect_ssh(), so we'll return the default '/usr/bin/python' to finish building the stack
# TODO: possible issues here? Chicken-and-egg issue, in order to `connect_ssh` we need a python path # TODO: possible issues here? Chicken-and-egg issue, in order to `connect_ssh` we need a python path
if action._finding_python_interpreter: if action is None or action._finding_python_interpreter or s is None:
return '/usr/bin/python' return '/usr/bin/python'
if s in ['auto', 'auto_legacy', 'auto_silent', 'auto_legacy_silent']: if s in ['auto', 'auto_legacy', 'auto_silent', 'auto_legacy_silent']:

Loading…
Cancel
Save