From 83fe2170fffa94bfd75c38de22217794335827b9 Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Fri, 20 Jan 2017 22:42:20 -0500 Subject: [PATCH] updates ensure_connect decorator function only calls _connect() if _connected is False --- lib/ansible/plugins/connection/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/plugins/connection/__init__.py b/lib/ansible/plugins/connection/__init__.py index e9fff76ace7..6bc1994b814 100644 --- a/lib/ansible/plugins/connection/__init__.py +++ b/lib/ansible/plugins/connection/__init__.py @@ -49,7 +49,8 @@ BUFSIZE = 65536 def ensure_connect(func): @wraps(func) def wrapped(self, *args, **kwargs): - self._connect() + if not self._connected: + self._connect() return func(self, *args, **kwargs) return wrapped