From d412bc72eff3182060cacd79024afcdf21fd2455 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Wed, 22 Jul 2015 16:14:17 -0400 Subject: [PATCH] Fall back to paramiko if the smart detection fails to run ssh Fixes #11695 --- lib/ansible/executor/task_executor.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/ansible/executor/task_executor.py b/lib/ansible/executor/task_executor.py index 75f3d34a5cb..a2f75a42285 100644 --- a/lib/ansible/executor/task_executor.py +++ b/lib/ansible/executor/task_executor.py @@ -407,9 +407,12 @@ class TaskExecutor: conn_type = "paramiko" else: # see if SSH can support ControlPersist if not use paramiko - cmd = subprocess.Popen(['ssh','-o','ControlPersist'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - (out, err) = cmd.communicate() - if "Bad configuration option" in err: + try: + cmd = subprocess.Popen(['ssh','-o','ControlPersist'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + (out, err) = cmd.communicate() + if "Bad configuration option" in err: + conn_type = "paramiko" + except OSError: conn_type = "paramiko" connection = connection_loader.get(conn_type, self._play_context, self._new_stdin)