now able to get the action object, but recursion error in low_level_exec_command

pull/658/head
Steven Robertson 5 years ago
parent 806651e112
commit 19ba2417c8

@ -551,6 +551,26 @@ class Connection(ansible.plugins.connection.ConnectionBase):
connection passed into any running action. connection passed into any running action.
""" """
if self._task_vars is not None: if self._task_vars is not None:
# check for if self._action has already been set or not
# there are some cases where the ansible executor passes in task_vars
# so we don't walk the stack to find them
# TODO: is there a better way to get the ActionModuleMixin object?
# ansible python discovery needs it to run discover_interpreter()
if not hasattr(self, '_action'):
f = sys._getframe()
while f:
if f.f_code.co_name == 'run':
f_self = f.f_locals.get('self')
if isinstance(f_self, ansible_mitogen.mixins.ActionModuleMixin):
self._action = f_self
break
elif f.f_code.co_name == '_execute_meta':
f_self = f.f_locals.get('self')
if isinstance(f_self, ansible_mitogen.mixins.ActionModuleMixin):
self._action = f_self
break
f = f.f_back
return self._task_vars return self._task_vars
f = sys._getframe() f = sys._getframe()

Loading…
Cancel
Save