From 356be2e65f76e045143b8b9cab306ed511afe2c9 Mon Sep 17 00:00:00 2001 From: Alex Willmer Date: Thu, 23 Jan 2025 12:59:36 +0000 Subject: [PATCH] ansible_mitogen: Remove unneeded internal _run_cmd() --- ansible_mitogen/mixins.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/ansible_mitogen/mixins.py b/ansible_mitogen/mixins.py index d1def2f6..2f66961b 100644 --- a/ansible_mitogen/mixins.py +++ b/ansible_mitogen/mixins.py @@ -476,18 +476,12 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase): # not used, just adding a filler value possible_pythons = ['python'] - def _run_cmd(): - return self._connection.exec_command( - cmd=cmd, - in_data=in_data, - sudoable=sudoable, - mitogen_chdir=chdir, - ) - for possible_python in possible_pythons: try: self._mitogen_interpreter_candidate = possible_python - rc, stdout, stderr = _run_cmd() + rc, stdout, stderr = self._connection.exec_command( + cmd, in_data, sudoable, mitogen_chdir=chdir, + ) # TODO: what exception is thrown? except: # we've reached the last python attempted and failed