diff options
author | Nathaniel Case <ncase@redhat.com> | 2019-08-14 16:58:03 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-14 16:58:03 -0400 |
commit | 7d3c4a88823846cbcea7c61de38658a6d63d4265 (patch) | |
tree | c12291ceb11b448bc925be1deccbe5d027787f99 /lib/ansible/cli | |
parent | f02f5c4b5dad36d696f028078ab545d75ba93d31 (diff) | |
download | ansible-7d3c4a88823846cbcea7c61de38658a6d63d4265.tar.gz |
Delay persistent connection until needed (#59153)
* Delay calling connect() until absolutely necessary
* Implement transport_test to enable wait_for_connection
* plugin might be connected already for some reason?
* ensure_connect for httpapi
There's some become shenanigans still needing to be ironed out
* Fix tests for network_cli
Diffstat (limited to 'lib/ansible/cli')
-rwxr-xr-x | lib/ansible/cli/scripts/ansible_connection_cli_stub.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/ansible/cli/scripts/ansible_connection_cli_stub.py b/lib/ansible/cli/scripts/ansible_connection_cli_stub.py index 2b4855410e..7351457e56 100755 --- a/lib/ansible/cli/scripts/ansible_connection_cli_stub.py +++ b/lib/ansible/cli/scripts/ansible_connection_cli_stub.py @@ -101,12 +101,9 @@ class ConnectionProcess(object): ansible_playbook_pid=self._ansible_playbook_pid) self.connection.set_options(var_options=variables) - self.connection._connect() - self.connection._socket_path = self.socket_path self.srv.register(self.connection) messages.extend([('vvvv', msg) for msg in sys.stdout.getvalue().splitlines()]) - messages.append(('vvvv', 'connection to remote device started successfully')) self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) self.sock.bind(self.socket_path) @@ -123,7 +120,7 @@ class ConnectionProcess(object): def run(self): try: - while self.connection.connected: + while True: signal.signal(signal.SIGALRM, self.connect_timeout) signal.signal(signal.SIGTERM, self.handler) signal.alarm(self.connection.get_option('persistent_connect_timeout')) |