diff --git a/ansible_mitogen/transport_config.py b/ansible_mitogen/transport_config.py index 0bdad4f3..6fcfba04 100644 --- a/ansible_mitogen/transport_config.py +++ b/ansible_mitogen/transport_config.py @@ -378,7 +378,15 @@ class PlayContextSpec(Spec): ] def become_exe(self): - return self._play_context.become_exe + # In Ansible 2.8, PlayContext.become_exe always has a default value due + # to the new options mechanism. Previously it was only set if a value + # ("somewhere") had been specified for the task. + # For consistency in the tests, here we make older Ansibles behave like + # newer Ansibles. + exe = self._play_context.become_exe + if exe is None and self._play_context.become_method == 'sudo': + exe = 'sudo' + return exe def sudo_args(self): return [ diff --git a/tests/ansible/integration/connection_delegation/local_action.yml b/tests/ansible/integration/connection_delegation/local_action.yml index 91fb9739..05fc3db9 100644 --- a/tests/ansible/integration/connection_delegation/local_action.yml +++ b/tests/ansible/integration/connection_delegation/local_action.yml @@ -27,7 +27,7 @@ 'remote_name': null, 'password': null, 'username': 'root', - 'sudo_path': null, + 'sudo_path': 'sudo', 'sudo_args': ['-H', '-S', '-n'], }, 'method': 'sudo',