mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07: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.vvvv("Exception during async poll, retrying... (%s)" % to_text(e))
|
||||||
display.debug("Async poll exception was:\n%s" % to_text(traceback.format_exc()))
|
display.debug("Async poll exception was:\n%s" % to_text(traceback.format_exc()))
|
||||||
try:
|
try:
|
||||||
normal_handler._connection._reset()
|
normal_handler._connection.reset()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ class ActionModule(ActionBase):
|
||||||
display.vvv("wait_for_connection: attempting ping module test")
|
display.vvv("wait_for_connection: attempting ping module test")
|
||||||
# call connection reset between runs if it's there
|
# call connection reset between runs if it's there
|
||||||
try:
|
try:
|
||||||
self._connection._reset()
|
self._connection.reset()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,7 @@ class ActionModule(ActionBase):
|
||||||
try:
|
try:
|
||||||
self._connection.set_option("connection_timeout",
|
self._connection.set_option("connection_timeout",
|
||||||
connect_timeout)
|
connect_timeout)
|
||||||
self._connection._reset()
|
self._connection.reset()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
display.warning("Connection plugin does not allow the "
|
display.warning("Connection plugin does not allow the "
|
||||||
"connection timeout to be overridden")
|
"connection timeout to be overridden")
|
||||||
|
@ -178,7 +178,7 @@ class ActionModule(ActionBase):
|
||||||
try:
|
try:
|
||||||
self._connection.set_option("connection_timeout",
|
self._connection.set_option("connection_timeout",
|
||||||
connection_timeout_orig)
|
connection_timeout_orig)
|
||||||
self._connection._reset()
|
self._connection.reset()
|
||||||
except (AnsibleError, AttributeError) as e:
|
except (AnsibleError, AttributeError) as e:
|
||||||
display.debug("Failed to reset connection_timeout back to default: %s" % to_native(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
|
# (another reboot occurred) we need to reset the connection
|
||||||
# to make sure we are not re-using the same shell id
|
# to make sure we are not re-using the same shell id
|
||||||
try:
|
try:
|
||||||
self._connection._reset()
|
self._connection.reset()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
raise
|
raise
|
||||||
|
|
|
@ -1108,7 +1108,7 @@ class Connection(ConnectionBase):
|
||||||
stdout, stderr = p.communicate()
|
stdout, stderr = p.communicate()
|
||||||
status_code = p.wait()
|
status_code = p.wait()
|
||||||
if status_code != 0:
|
if status_code != 0:
|
||||||
raise AnsibleError("Cannot reset connection:\n%s" % stderr)
|
display.warning("Failed to reset connection:%s" % stderr)
|
||||||
|
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
|
|
|
@ -483,7 +483,7 @@ class Connection(ConnectionBase):
|
||||||
self._connected = True
|
self._connected = True
|
||||||
return self
|
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.protocol = None
|
||||||
self.shell_id = None
|
self.shell_id = None
|
||||||
self._connect()
|
self._connect()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue