fix ssh_transfer_method/scp_if_ssh defaults (#74925)

* fix ssh_transfer_method/scp_if_ssh defaults

  fixes #74922

* clog
pull/74967/head
Brian Coca 4 years ago committed by GitHub
parent 50e998e303
commit 675df166c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,4 @@
bugfixes:
- ssh connection, fix interaction between trasnfer settings options.
minor_changes:
- ssh connection, can not configure ssh_transfer_method with a variable.

@ -272,7 +272,6 @@ DOCUMENTATION = '''
- name: ansible_sftp_batch_mode - name: ansible_sftp_batch_mode
version_added: '2.7' version_added: '2.7'
ssh_transfer_method: ssh_transfer_method:
default: smart
description: description:
- "Preferred method to use when transferring files over ssh" - "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 - Setting to 'smart' (default) will try them in order, until one succeeds or they all fail
@ -281,6 +280,9 @@ DOCUMENTATION = '''
env: [{name: ANSIBLE_SSH_TRANSFER_METHOD}] env: [{name: ANSIBLE_SSH_TRANSFER_METHOD}]
ini: ini:
- {key: transfer_method, section: ssh_connection} - {key: transfer_method, section: ssh_connection}
vars:
- name: ansible_ssh_transfer_method
version_added: '2.12'
scp_if_ssh: scp_if_ssh:
default: smart default: smart
description: description:
@ -1172,6 +1174,10 @@ class Connection(ConnectionBase):
# Use the transfer_method option if set, otherwise use scp_if_ssh # Use the transfer_method option if set, otherwise use scp_if_ssh
ssh_transfer_method = self.get_option('ssh_transfer_method') 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 is not None:
if ssh_transfer_method == 'smart': if ssh_transfer_method == 'smart':
methods = smart_methods methods = smart_methods
@ -1179,7 +1185,6 @@ class Connection(ConnectionBase):
methods = [ssh_transfer_method] methods = [ssh_transfer_method]
else: else:
# since this can be a non-bool now, we need to handle it correctly # 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): if not isinstance(scp_if_ssh, bool):
scp_if_ssh = scp_if_ssh.lower() scp_if_ssh = scp_if_ssh.lower()
if scp_if_ssh in BOOLEANS: if scp_if_ssh in BOOLEANS:

Loading…
Cancel
Save