mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 20:01:25 -07:00
Modify task executor to reuse connection inside a loop. Fix WinRM connection to set _connected properly and display when remote shell is opened/closed. Add integration test using raw + with_items.
This commit is contained in:
parent
478c6c756a
commit
272778f732
3 changed files with 28 additions and 7 deletions
|
@ -67,6 +67,7 @@ class TaskExecutor:
|
|||
self._new_stdin = new_stdin
|
||||
self._loader = loader
|
||||
self._shared_loader_obj = shared_loader_obj
|
||||
self._connection = None
|
||||
|
||||
def run(self):
|
||||
'''
|
||||
|
@ -361,8 +362,9 @@ class TaskExecutor:
|
|||
self._task.args = variable_params
|
||||
|
||||
# get the connection and the handler for this execution
|
||||
self._connection = self._get_connection(variables=variables, templar=templar)
|
||||
self._connection.set_host_overrides(host=self._host)
|
||||
if not self._connection or not getattr(self._connection, '_connected', False):
|
||||
self._connection = self._get_connection(variables=variables, templar=templar)
|
||||
self._connection.set_host_overrides(host=self._host)
|
||||
|
||||
self._handler = self._get_action_handler(connection=self._connection, templar=templar)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue