From ee12bafe48bb1ca79ba5936ff7e2664bd62b6173 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 13 Jul 2023 12:57:26 -0400 Subject: [PATCH] deprecate 'smart' connection value (#81218) Co-authored-by: Jordan Borean --- changelogs/fragments/smart_connection_bye.yml | 4 ++++ lib/ansible/config/base.yml | 7 ++++--- lib/ansible/utils/ssh_functions.py | 7 ++++--- 3 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 changelogs/fragments/smart_connection_bye.yml diff --git a/changelogs/fragments/smart_connection_bye.yml b/changelogs/fragments/smart_connection_bye.yml new file mode 100644 index 00000000000..b9339960aff --- /dev/null +++ b/changelogs/fragments/smart_connection_bye.yml @@ -0,0 +1,4 @@ +minor_changes: + - DEFAULT_TRANSPORT now defaults to 'ssh', the old 'smart' option is being deprecated as versions of OpenSSH without control persist are basically not present anymore. +deprecated_features: + - the 'smart' option for setting a connection plugin is being removed as it's main purpose (choosing between ssh and paramiko) is now irrelevant. diff --git a/lib/ansible/config/base.yml b/lib/ansible/config/base.yml index 97d1b432423..9f4c17d494a 100644 --- a/lib/ansible/config/base.yml +++ b/lib/ansible/config/base.yml @@ -1102,10 +1102,11 @@ DEFAULT_TIMEOUT: - {key: timeout, section: defaults} type: integer DEFAULT_TRANSPORT: - # note that ssh_utils refs this and needs to be updated if removed name: Connection plugin - default: smart - description: "Default connection plugin to use, the 'smart' option will toggle between 'ssh' and 'paramiko' depending on controller OS and ssh versions" + default: ssh + description: + - Can be any connection plugin available to your ansible installation. + - There is also a (DEPRECATED) special 'smart' option, that will toggle between 'ssh' and 'paramiko' depending on controller OS and ssh versions. env: [{name: ANSIBLE_TRANSPORT}] ini: - {key: transport, section: defaults} diff --git a/lib/ansible/utils/ssh_functions.py b/lib/ansible/utils/ssh_functions.py index e1b65668511..038e717201e 100644 --- a/lib/ansible/utils/ssh_functions.py +++ b/lib/ansible/utils/ssh_functions.py @@ -25,6 +25,9 @@ import subprocess from ansible import constants as C from ansible.module_utils.common.text.converters import to_bytes from ansible.module_utils.compat.paramiko import paramiko +from ansible.utils.display import Display + +display = Display() _HAS_CONTROLPERSIST = {} # type: dict[str, bool] @@ -51,13 +54,11 @@ def check_for_controlpersist(ssh_executable): return has_cp -# TODO: move to 'smart' connection plugin that subclasses to ssh/paramiko as needed. def set_default_transport(): # deal with 'smart' connection .. one time .. if C.DEFAULT_TRANSPORT == 'smart': - # TODO: check if we can deprecate this as ssh w/o control persist should - # not be as common anymore. + display.deprecated("The 'smart' option for connections is deprecated. Set the connection plugin directly instead.", version=2.19) # see if SSH can support ControlPersist if not use paramiko if not check_for_controlpersist('ssh') and paramiko is not None: