mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
win_reboot: fix 2.6 issues and better handle post reboot reboot (#42330)
* win_reboot: fix 2.6 issues and better handle post reboot reboot * changed winrm _reset to reset * Add handler to reset calls when .reset() throws an AnsibleError on older hosts * Moving back to _reset to get the issue fixed
This commit is contained in:
@@ -181,12 +181,11 @@ class Connection(ConnectionBase):
|
||||
|
||||
super(Connection, self).__init__(*args, **kwargs)
|
||||
|
||||
def set_options(self, task_keys=None, var_options=None, direct=None):
|
||||
if not HAS_WINRM:
|
||||
return
|
||||
|
||||
super(Connection, self).set_options(task_keys=None, var_options=var_options, direct=direct)
|
||||
|
||||
def _build_winrm_kwargs(self):
|
||||
# this used to be in set_options, as win_reboot needs to be able to
|
||||
# override the conn timeout, we need to be able to build the args
|
||||
# after setting individual options. This is called by _connect before
|
||||
# starting the WinRM connection
|
||||
self._winrm_host = self.get_option('remote_addr')
|
||||
self._winrm_user = self.get_option('remote_user')
|
||||
self._winrm_pass = self._play_context.password
|
||||
@@ -479,6 +478,7 @@ class Connection(ConnectionBase):
|
||||
|
||||
super(Connection, self)._connect()
|
||||
if not self.protocol:
|
||||
self._build_winrm_kwargs() # build the kwargs from the options set
|
||||
self.protocol = self._winrm_connect()
|
||||
self._connected = True
|
||||
return self
|
||||
|
||||
Reference in New Issue
Block a user