mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Move check for accelerate mode deeper to account for ansible_connection
Fixes #4045
This commit is contained in:
parent
20b0dc4abd
commit
2cbf28385a
1 changed files with 10 additions and 8 deletions
|
@ -186,13 +186,7 @@ class Runner(object):
|
|||
self.accelerate_port = accelerate_port
|
||||
self.callbacks.runner = self
|
||||
|
||||
if self.accelerate and self.transport != 'local':
|
||||
# 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 self.transport == 'smart':
|
||||
# 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
|
||||
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_transport = inject.get('ansible_connection', self.transport)
|
||||
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' ]:
|
||||
actual_port = inject.get('ansible_ssh_port', port)
|
||||
|
||||
|
@ -620,7 +622,7 @@ class Runner(object):
|
|||
inject['ansible_ssh_user'] = actual_user
|
||||
|
||||
try:
|
||||
if self.transport == 'accelerate':
|
||||
if actual_transport == 'accelerate':
|
||||
# for accelerate, we stuff both ports into a single
|
||||
# variable so that we don't have to mangle other function
|
||||
# calls just to accomodate this one case
|
||||
|
|
Loading…
Reference in a new issue