mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 04:40:22 -07:00
Winrm fixes for devel
* Include fixes for winrm connection plugin from v1 code * Fixing shell plugin use
This commit is contained in:
parent
2a8ab4ab3e
commit
2a5fbd8570
4 changed files with 40 additions and 30 deletions
|
@ -31,6 +31,7 @@ from six import with_metaclass
|
|||
|
||||
from ansible import constants as C
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.plugins import shell_loader
|
||||
|
||||
# FIXME: this object should be created upfront and passed through
|
||||
# the entire chain of calls to here, as there are other things
|
||||
|
@ -71,6 +72,18 @@ class ConnectionBase(with_metaclass(ABCMeta, object)):
|
|||
self.success_key = None
|
||||
self.prompt = None
|
||||
|
||||
# load the shell plugin for this action/connection
|
||||
if connection_info.shell:
|
||||
shell_type = connection_info.shell
|
||||
elif hasattr(self, '_shell_type'):
|
||||
shell_type = getattr(self, '_shell_type')
|
||||
else:
|
||||
shell_type = os.path.basename(C.DEFAULT_EXECUTABLE)
|
||||
|
||||
self._shell = shell_loader.get(shell_type)
|
||||
if not self._shell:
|
||||
raise AnsibleError("Invalid shell type specified (%s), or the plugin for that shell type is missing." % shell_type)
|
||||
|
||||
def _become_method_supported(self):
|
||||
''' Checks if the current class supports this privilege escalation method '''
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ from ansible.plugins import shell_loader
|
|||
from ansible.utils.path import makedirs_safe
|
||||
from ansible.utils.unicode import to_bytes
|
||||
|
||||
|
||||
class Connection(ConnectionBase):
|
||||
'''WinRM connections over HTTP/HTTPS.'''
|
||||
|
||||
|
@ -63,8 +62,7 @@ class Connection(ConnectionBase):
|
|||
self.protocol = None
|
||||
self.shell_id = None
|
||||
self.delegate = None
|
||||
|
||||
self._shell = shell_loader.get('powershell')
|
||||
self._shell_type = 'powershell'
|
||||
|
||||
# TODO: Add runas support
|
||||
self.become_methods_supported=[]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue