mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
changed winrm _reset to reset and make ssh reset show warning (#42651)
* changed winrm _reset to reset and make ssh reset show warning * minor changelog update
This commit is contained in:
parent
a5fc9a17f0
commit
d723b8541d
6 changed files with 10 additions and 7 deletions
3
changelogs/fragments/connection_reset.yaml
Normal file
3
changelogs/fragments/connection_reset.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
minor_changes:
|
||||
- ssh - reset connection will show a warning instead of failing for older OpenSSH versions
|
||||
- winrm - change the _reset() method to use reset() that is part of ConnectionBase
|
|
@ -767,7 +767,7 @@ class TaskExecutor:
|
|||
display.vvvv("Exception during async poll, retrying... (%s)" % to_text(e))
|
||||
display.debug("Async poll exception was:\n%s" % to_text(traceback.format_exc()))
|
||||
try:
|
||||
normal_handler._connection._reset()
|
||||
normal_handler._connection.reset()
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ class ActionModule(ActionBase):
|
|||
display.vvv("wait_for_connection: attempting ping module test")
|
||||
# call connection reset between runs if it's there
|
||||
try:
|
||||
self._connection._reset()
|
||||
self._connection.reset()
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ class ActionModule(ActionBase):
|
|||
try:
|
||||
self._connection.set_option("connection_timeout",
|
||||
connect_timeout)
|
||||
self._connection._reset()
|
||||
self._connection.reset()
|
||||
except AttributeError:
|
||||
display.warning("Connection plugin does not allow the "
|
||||
"connection timeout to be overridden")
|
||||
|
@ -178,7 +178,7 @@ class ActionModule(ActionBase):
|
|||
try:
|
||||
self._connection.set_option("connection_timeout",
|
||||
connection_timeout_orig)
|
||||
self._connection._reset()
|
||||
self._connection.reset()
|
||||
except (AnsibleError, AttributeError) as e:
|
||||
display.debug("Failed to reset connection_timeout back to default: %s" % to_native(e))
|
||||
|
||||
|
@ -192,7 +192,7 @@ class ActionModule(ActionBase):
|
|||
# (another reboot occurred) we need to reset the connection
|
||||
# to make sure we are not re-using the same shell id
|
||||
try:
|
||||
self._connection._reset()
|
||||
self._connection.reset()
|
||||
except AttributeError:
|
||||
pass
|
||||
raise
|
||||
|
|
|
@ -1108,7 +1108,7 @@ class Connection(ConnectionBase):
|
|||
stdout, stderr = p.communicate()
|
||||
status_code = p.wait()
|
||||
if status_code != 0:
|
||||
raise AnsibleError("Cannot reset connection:\n%s" % stderr)
|
||||
display.warning("Failed to reset connection:%s" % stderr)
|
||||
|
||||
self.close()
|
||||
|
||||
|
|
|
@ -483,7 +483,7 @@ class Connection(ConnectionBase):
|
|||
self._connected = True
|
||||
return self
|
||||
|
||||
def _reset(self): # used by win_reboot (and any other action that might need to bounce the state)
|
||||
def reset(self):
|
||||
self.protocol = None
|
||||
self.shell_id = None
|
||||
self._connect()
|
||||
|
|
Loading…
Reference in a new issue