summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Coca <bcoca@users.noreply.github.com>2021-06-14 15:18:48 -0400
committerGitHub <noreply@github.com>2021-06-14 14:18:48 -0500
commitdce10b89ad9fe3f4d0f6be4c521fe7239f552e33 (patch)
treea2747db4a0222c79524c904be5e188e29ff1b04d
parent7448c2fa62d78123d43d01cccb03318e0317eb75 (diff)
downloadansible-dce10b89ad9fe3f4d0f6be4c521fe7239f552e33.tar.gz
Ssh opts fix (#74972)
(cherry picked from commit 675df166c27bc82a4d9a7cba45e11aec0300ae2c)
-rw-r--r--changelogs/fragments/fix_scp_ssh_settings.yml2
-rw-r--r--lib/ansible/plugins/connection/ssh.py6
2 files changed, 6 insertions, 2 deletions
diff --git a/changelogs/fragments/fix_scp_ssh_settings.yml b/changelogs/fragments/fix_scp_ssh_settings.yml
new file mode 100644
index 0000000000..d61acbfdd3
--- /dev/null
+++ b/changelogs/fragments/fix_scp_ssh_settings.yml
@@ -0,0 +1,2 @@
+bugfixes:
+ - ssh connection - fix interaction between transfer settings options.
diff --git a/lib/ansible/plugins/connection/ssh.py b/lib/ansible/plugins/connection/ssh.py
index 02d776e14b..36cec80b03 100644
--- a/lib/ansible/plugins/connection/ssh.py
+++ b/lib/ansible/plugins/connection/ssh.py
@@ -271,7 +271,6 @@ DOCUMENTATION = '''
- name: ansible_sftp_batch_mode
version_added: '2.7'
ssh_transfer_method:
- default: smart
description:
- "Preferred method to use when transferring files over ssh"
- Setting to 'smart' (default) will try them in order, until one succeeds or they all fail
@@ -1145,6 +1144,10 @@ class Connection(ConnectionBase):
# Use the transfer_method option if set, otherwise use scp_if_ssh
ssh_transfer_method = self.get_option('ssh_transfer_method')
+ scp_if_ssh = self.get_option('scp_if_ssh')
+ if ssh_transfer_method is None and scp_if_ssh == 'smart':
+ ssh_transfer_method = 'smart'
+
if ssh_transfer_method is not None:
if ssh_transfer_method == 'smart':
methods = smart_methods
@@ -1152,7 +1155,6 @@ class Connection(ConnectionBase):
methods = [ssh_transfer_method]
else:
# since this can be a non-bool now, we need to handle it correctly
- scp_if_ssh = self.get_option('scp_if_ssh')
if not isinstance(scp_if_ssh, bool):
scp_if_ssh = scp_if_ssh.lower()
if scp_if_ssh in BOOLEANS: