Move check for accelerate mode deeper to account for ansible_connection

Fixes #4045
pull/3975/merge
James Cammarata 11 years ago
parent 20b0dc4abd
commit 2cbf28385a

@ -186,13 +186,7 @@ class Runner(object):
self.accelerate_port = accelerate_port self.accelerate_port = accelerate_port
self.callbacks.runner = self self.callbacks.runner = self
if self.accelerate and self.transport != 'local': if self.transport == 'smart':
# if we're using accelerated mode, force the
# transport to accelerate
self.transport = "accelerate"
if not self.accelerate_port:
self.accelerate_port = C.ACCELERATE_PORT
elif self.transport == 'smart':
# if the transport is 'smart' see if SSH can support ControlPersist if not use paramiko # if the transport is 'smart' see if SSH can support ControlPersist if not use paramiko
# 'smart' is the default since 1.2.1/1.3 # 'smart' is the default since 1.2.1/1.3
cmd = subprocess.Popen(['ssh','-o','ControlPersist'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) cmd = subprocess.Popen(['ssh','-o','ControlPersist'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@ -579,6 +573,14 @@ class Runner(object):
actual_pass = inject.get('ansible_ssh_pass', self.remote_pass) actual_pass = inject.get('ansible_ssh_pass', self.remote_pass)
actual_transport = inject.get('ansible_connection', self.transport) actual_transport = inject.get('ansible_connection', self.transport)
actual_private_key_file = inject.get('ansible_ssh_private_key_file', self.private_key_file) actual_private_key_file = inject.get('ansible_ssh_private_key_file', self.private_key_file)
if self.accelerate and actual_transport != 'local':
# if we're using accelerated mode, force the
# transport to accelerate
actual_transport = "accelerate"
if not self.accelerate_port:
self.accelerate_port = C.ACCELERATE_PORT
if actual_transport in [ 'paramiko', 'ssh', 'accelerate' ]: if actual_transport in [ 'paramiko', 'ssh', 'accelerate' ]:
actual_port = inject.get('ansible_ssh_port', port) actual_port = inject.get('ansible_ssh_port', port)
@ -620,7 +622,7 @@ class Runner(object):
inject['ansible_ssh_user'] = actual_user inject['ansible_ssh_user'] = actual_user
try: try:
if self.transport == 'accelerate': if actual_transport == 'accelerate':
# for accelerate, we stuff both ports into a single # for accelerate, we stuff both ports into a single
# variable so that we don't have to mangle other function # variable so that we don't have to mangle other function
# calls just to accomodate this one case # calls just to accomodate this one case

Loading…
Cancel
Save