issue #587: mitogen_doas should not become_exe for doas_path

Looks like this has always been wrong - when used as a connection
method, PlayContext.become_method/become_exe may hold totally unrelated
data.
pull/595/head
David Wilson 5 years ago
parent b8e1b4df51
commit f35194fe0f

@ -356,7 +356,7 @@ def _connect_mitogen_doas(spec):
'username': spec.remote_user(),
'password': spec.password(),
'python_path': spec.python_path(),
'doas_path': spec.become_exe(),
'doas_path': spec.ansible_doas_exe(),
'connect_timeout': spec.timeout(),
'remote_name': get_remote_name(spec),
}

@ -294,6 +294,12 @@ class Spec(with_metaclass(abc.ABCMeta, object)):
Connection-specific arguments.
"""
@abc.abstractmethod
def ansible_doas_exe(self):
"""
Value of "ansible_doas_exe" variable.
"""
class PlayContextSpec(Spec):
"""
@ -425,6 +431,12 @@ class PlayContextSpec(Spec):
def extra_args(self):
return self._connection.get_extra_args()
def ansible_doas_exe(self):
return (
self._connection.get_task_var('ansible_doas_exe') or
os.environ.get('ANSIBLE_DOAS_EXE')
)
class MitogenViaSpec(Spec):
"""
@ -635,3 +647,9 @@ class MitogenViaSpec(Spec):
def extra_args(self):
return [] # TODO
def ansible_doas_exe(self):
return (
self._host_vars.get('ansible_doas_exe') or
os.environ.get('ANSIBLE_DOAS_EXE')
)

Loading…
Cancel
Save