Fix reset_connection paramiko, winrm, psrp (#72688)
* Ensure we only reset the connection when one has been previously established. Fixes #65812 * Ensure psrp doesn't trace * winrm too * Indentation fix
This commit is contained in:
parent
36ab3d1189
commit
a3b6485073
6 changed files with 16 additions and 0 deletions
3
changelogs/fragments/65812-paramiko-attribute-error.yml
Normal file
3
changelogs/fragments/65812-paramiko-attribute-error.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
bugfixes:
|
||||
- paramiko connection plugin - Ensure we only reset the connection when one has been
|
||||
previously established (https://github.com/ansible/ansible/issues/65812)
|
|
@ -536,6 +536,8 @@ class Connection(ConnectionBase):
|
|||
f.write("%s %s %s\n" % (hostname, keytype, key.get_base64()))
|
||||
|
||||
def reset(self):
|
||||
if not self._connected:
|
||||
return
|
||||
self.close()
|
||||
self._connect()
|
||||
|
||||
|
|
|
@ -407,6 +407,8 @@ class Connection(ConnectionBase):
|
|||
return self
|
||||
|
||||
def reset(self):
|
||||
if not self._connected:
|
||||
return
|
||||
display.vvvvv("PSRP: Reset Connection", host=self._psrp_host)
|
||||
self.runspace = None
|
||||
self._connect()
|
||||
|
|
|
@ -534,6 +534,8 @@ class Connection(ConnectionBase):
|
|||
return self
|
||||
|
||||
def reset(self):
|
||||
if not self._connected:
|
||||
return
|
||||
self.protocol = None
|
||||
self.shell_id = None
|
||||
self._connect()
|
||||
|
|
|
@ -21,3 +21,5 @@ then
|
|||
else
|
||||
echo "SUCCESS: Connection vars not found"
|
||||
fi
|
||||
|
||||
ansible-playbook test_reset_connection.yml -i "${INVENTORY}" "$@"
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
- hosts: "{{ target_hosts }}"
|
||||
gather_facts: no
|
||||
tasks:
|
||||
# https://github.com/ansible/ansible/issues/65812
|
||||
- meta: reset_connection
|
Loading…
Reference in a new issue