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

pull/595/head
David Wilson 6 years ago
parent a25fa566a1
commit 92b4724010

@ -378,7 +378,15 @@ class PlayContextSpec(Spec):
] ]
def become_exe(self): 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): def sudo_args(self):
return [ return [

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

Loading…
Cancel
Save