Fix ansible-connection persist after playbook run complete issue (#61591)
* Fix ansible-connection persist after playbook run issue * PR https://github.com/ansible/ansible/pull/59153 to add support for delaying the ansible-connection added an old issue of ansible-connection persisting even after playbook run is finished till either command timeout or connect timeout is triggered. ansible-connection persist after playbook execution is done and also delays the connection initilization untill a method in invoked from module side on the connection object. * Add chanegelog
This commit is contained in:
parent
e6fe52bc56
commit
4f29b5a76b
3 changed files with 5 additions and 1 deletions
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- ansible-connection persists even after playbook run is completed (https://github.com/ansible/ansible/pull/61591)
|
|
@ -120,7 +120,7 @@ class ConnectionProcess(object):
|
|||
|
||||
def run(self):
|
||||
try:
|
||||
while True:
|
||||
while not self.connection._conn_closed:
|
||||
signal.signal(signal.SIGALRM, self.connect_timeout)
|
||||
signal.signal(signal.SIGTERM, self.handler)
|
||||
signal.alarm(self.connection.get_option('persistent_connect_timeout'))
|
||||
|
|
|
@ -275,6 +275,7 @@ class NetworkConnectionBase(ConnectionBase):
|
|||
def __init__(self, play_context, new_stdin, *args, **kwargs):
|
||||
super(NetworkConnectionBase, self).__init__(play_context, new_stdin, *args, **kwargs)
|
||||
self._messages = []
|
||||
self._conn_closed = False
|
||||
|
||||
self._network_os = self._play_context.network_os
|
||||
|
||||
|
@ -335,6 +336,7 @@ class NetworkConnectionBase(ConnectionBase):
|
|||
self.queue_message('vvvv', 'reset call on connection instance')
|
||||
|
||||
def close(self):
|
||||
self._conn_closed = True
|
||||
if self._connected:
|
||||
self._connected = False
|
||||
|
||||
|
|
Loading…
Reference in a new issue