From 1e4c38926894e3f274ee3ae91b0a58cf9e35a45a Mon Sep 17 00:00:00 2001 From: Stephan Lohse Date: Tue, 8 May 2018 03:30:24 +0200 Subject: [PATCH] allow become methods for Jail connection plugin (#31746) * allow become methods - i personally tested 'su', 'sudo' and 'doas' * forgot to import constants m( --- lib/ansible/plugins/connection/jail.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/ansible/plugins/connection/jail.py b/lib/ansible/plugins/connection/jail.py index ca4f72dd71..6d1a051cc3 100644 --- a/lib/ansible/plugins/connection/jail.py +++ b/lib/ansible/plugins/connection/jail.py @@ -36,6 +36,7 @@ import os import os.path import subprocess import traceback +import ansible.constants as C from ansible.errors import AnsibleError from ansible.module_utils.six.moves import shlex_quote @@ -58,10 +59,8 @@ class Connection(ConnectionBase): # Pipelining may work. Someone needs to test by setting this to True and # having pipelining=True in their ansible.cfg has_pipelining = True - # Some become_methods may work in v2 (sudo works for other chroot-based - # plugins while su seems to be failing). If some work, check chroot.py to - # see how to disable just some methods. - become_methods = frozenset() + + become_methods = frozenset(C.BECOME_METHODS) def __init__(self, play_context, new_stdin, *args, **kwargs): super(Connection, self).__init__(play_context, new_stdin, *args, **kwargs)