accidentally broke discovery

pull/658/head
Steven Robertson 5 years ago
parent 160dbd86b4
commit aa0ad5ce8f

@ -504,7 +504,9 @@ class Connection(ansible.plugins.connection.ConnectionBase):
loader_basedir = None loader_basedir = None
# set by `_get_task_vars()` for interpreter discovery # set by `_get_task_vars()` for interpreter discovery
_action = None # we need it to be an object with the value of "_finding_python_interpreter" in case we aren't
# running interpreter discovery fully
_action = type('actionTemp', (object,), {'_finding_python_interpreter': False})
# redeclaring interpreter discovery vars here in case running ansible < 2.8.0 # redeclaring interpreter discovery vars here in case running ansible < 2.8.0
_discovered_interpreter_key = None _discovered_interpreter_key = None
_discovered_interpreter = False _discovered_interpreter = False
@ -564,7 +566,7 @@ class Connection(ansible.plugins.connection.ConnectionBase):
# so we don't walk the stack to find them # so we don't walk the stack to find them
# TODO: is there a better way to get the ActionModuleMixin object? # TODO: is there a better way to get the ActionModuleMixin object?
# ansible python discovery needs it to run discover_interpreter() # ansible python discovery needs it to run discover_interpreter()
if not hasattr(self, '_action'): if not isinstance(self._action, ansible_mitogen.mixins.ActionModuleMixin):
f = sys._getframe() f = sys._getframe()
while f: while f:
if f.f_code.co_name == 'run': if f.f_code.co_name == 'run':

@ -87,7 +87,7 @@ def run_interpreter_discovery_if_necessary(s, task_vars, action):
# 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 is None or action._finding_python_interpreter or s is None: if 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