mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
added become_method list and pipeline support to connection class methods
added generic method to check supported become methods for the connection plugin
This commit is contained in:
parent
cd26aead17
commit
cf96c7719e
1 changed files with 11 additions and 1 deletions
|
@ -34,8 +34,18 @@ class ConnectionBase:
|
|||
A base class for connections to contain common code.
|
||||
'''
|
||||
|
||||
has_pipelining = False
|
||||
become_methods = C.BECOME_METHODS
|
||||
|
||||
def __init__(self, connection_info, *args, **kwargs):
|
||||
self._connection_info = connection_info
|
||||
self._has_pipelining = False
|
||||
self._display = Display(connection_info)
|
||||
|
||||
|
||||
def _become_method_supported(self, become_method):
|
||||
''' Checks if the current class supports this privilege escalation method '''
|
||||
|
||||
if become_method in self.__class__.become_methods:
|
||||
return True
|
||||
|
||||
raise errors.AnsibleError("Internal Error: this connection module does not support running commands via %s" % become_method)
|
||||
|
|
Loading…
Reference in a new issue