From 0dbebfddaa6a82538ea16e64c4f3ebc8d2083e07 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 9 Sep 2015 14:21:56 -0400 Subject: [PATCH] Revert "remove closing connections after every task, this goes against conneciton caching and was not expected behaviuor nor inhertited from v1" needed for winrm, disabled closing connections in ssh to avoid issues with that persistance, need to normalize all this in future This reverts commit 23a22397bfdbcf9d8a4b9037fc5fb63ae8dcefc1. --- lib/ansible/executor/task_executor.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/ansible/executor/task_executor.py b/lib/ansible/executor/task_executor.py index fd174a8421e..9feb5f42c51 100644 --- a/lib/ansible/executor/task_executor.py +++ b/lib/ansible/executor/task_executor.py @@ -129,6 +129,13 @@ class TaskExecutor: return result except AnsibleError as e: return dict(failed=True, msg=to_unicode(e, nonstring='simplerepr')) + finally: + try: + self._connection.close() + except AttributeError: + pass + except Exception as e: + debug("error closing connection: %s" % to_unicode(e)) def _get_loop_items(self): '''