From 6af5455edcd843a31a0b20eb103f37445b582672 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Thu, 25 Sep 2014 19:22:35 -0500 Subject: [PATCH] Default 'smart' connection to paramiko for OSX platforms Due to the long-standing bug in sshpass, which can crash OSX. Fixes #5007 --- lib/ansible/runner/__init__.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index a1133fdbad..7e093f3537 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -214,14 +214,18 @@ class Runner(object): self.run_once = run_once if self.transport == 'smart': - # if the transport is 'smart' see if SSH can support ControlPersist if not use paramiko + # If the transport is 'smart', check to see if certain conditions + # would prevent us from using ssh, and fallback to paramiko. # 'smart' is the default since 1.2.1/1.3 - cmd = subprocess.Popen(['ssh','-o','ControlPersist'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - (out, err) = cmd.communicate() - if "Bad configuration option" in err: + self.transport = "ssh" + if sys.platform.startswith('darwin'): self.transport = "paramiko" else: - self.transport = "ssh" + # 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: + self.transport = "paramiko" # save the original transport, in case it gets # changed later via options like accelerate