issue #587: consistent become_exe() behaviour for older Ansibles.

This commit is contained in:
David Wilson 2019-05-26 12:06:14 +01:00
parent a25fa566a1
commit 92b4724010
2 changed files with 10 additions and 2 deletions

View File

@ -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 [

View File

@ -27,7 +27,7 @@
'remote_name': null,
'password': null,
'username': 'root',
'sudo_path': null,
'sudo_path': 'sudo',
'sudo_args': ['-H', '-S', '-n'],
},
'method': 'sudo',