From 58856f69abbace2938eab057c8ffee10dd2d935e Mon Sep 17 00:00:00 2001 From: rallytime Date: Wed, 26 Sep 2018 10:13:42 -0400 Subject: [PATCH 1/3] Handle neon deprecations in the ssh module Fixes #49412 Conflicts: - doc/topics/releases/neon.rst --- doc/topics/releases/neon.rst | 10 ++++ salt/modules/ssh.py | 90 ------------------------------------ 2 files changed, 10 insertions(+), 90 deletions(-) diff --git a/doc/topics/releases/neon.rst b/doc/topics/releases/neon.rst index 0d19bf0d2888..93cc2fe3c230 100644 --- a/doc/topics/releases/neon.rst +++ b/doc/topics/releases/neon.rst @@ -147,6 +147,16 @@ Module Deprecations - :py:func:`dockermod.load ` - :py:func:`dockermod.tag ` +- The :py:mod:`ssh ` execution module has been + changed as follows: + + - Support for the ``ssh.get_known_host`` function has been removed. Please use the + :py:func:`ssh.get_known_host_entries ` + function instead. + - Support for the ``ssh.recv_known_host`` function has been removed. Please use the + :py:func:`ssh.recv_known_host_entries ` + function instead. + State Deprecations ------------------ diff --git a/salt/modules/ssh.py b/salt/modules/ssh.py index 89bbb2316727..44b882655b74 100644 --- a/salt/modules/ssh.py +++ b/salt/modules/ssh.py @@ -25,7 +25,6 @@ import salt.utils.path import salt.utils.platform import salt.utils.stringutils -import salt.utils.versions from salt.exceptions import ( SaltInvocationError, CommandExecutionError, @@ -837,36 +836,6 @@ def _parse_openssh_output(lines, fingerprint_hash_type=None): 'fingerprint': fingerprint} -@salt.utils.decorators.path.which('ssh-keygen') -def get_known_host(user, - hostname, - config=None, - port=None, - fingerprint_hash_type=None): - ''' - .. deprecated:: 2018.3.0 - Use :py:func:`ssh.get_known_host_entries - ` instead. - - Return information about known host from the configfile, if any. - If there is no such key, return None. - - CLI Example: - - .. code-block:: bash - - salt '*' ssh.get_known_host - ''' - salt.utils.versions.warn_until( - 'Neon', - '\'get_known_host\' has been deprecated in favor of ' - '\'get_known_host_entries\'. \'get_known_host\' will be ' - 'removed in Salt Neon.' - ) - known_hosts = get_known_host_entries(user, hostname, config, port, fingerprint_hash_type) - return known_hosts[0] if known_hosts else None - - @salt.utils.decorators.path.which('ssh-keygen') def get_known_host_entries(user, hostname, @@ -902,65 +871,6 @@ def get_known_host_entries(user, return known_host_entries if known_host_entries else None -@salt.utils.decorators.path.which('ssh-keyscan') -def recv_known_host(hostname, - enc=None, - port=None, - hash_known_hosts=True, - timeout=5, - fingerprint_hash_type=None): - ''' - Retrieve information about host public key from remote server - - .. deprecated:: 2018.3.0 - Use :py:func:`ssh.recv_known_host_entries - ` instead. - - hostname - The name of the remote host (e.g. "github.com") - - enc - Defines what type of key is being used, can be ed25519, ecdsa ssh-rsa - or ssh-dss - - port - Optional parameter, denoting the port of the remote host on which an - SSH daemon is running. By default the port 22 is used. - - hash_known_hosts : True - Hash all hostnames and addresses in the known hosts file. - - timeout : int - Set the timeout for connection attempts. If ``timeout`` seconds have - elapsed since a connection was initiated to a host or since the last - time anything was read from that host, then the connection is closed - and the host in question considered unavailable. Default is 5 seconds. - - .. versionadded:: 2016.3.0 - - fingerprint_hash_type - The fingerprint hash type that the public key fingerprints were - originally hashed with. This defaults to ``sha256`` if not specified. - - .. versionadded:: 2016.11.4 - .. versionchanged:: 2017.7.0: default changed from ``md5`` to ``sha256`` - - CLI Example: - - .. code-block:: bash - - salt '*' ssh.recv_known_host enc= port= - ''' - salt.utils.versions.warn_until( - 'Neon', - '\'recv_known_host\' has been deprecated in favor of ' - '\'recv_known_host_entries\'. \'recv_known_host\' will be ' - 'removed in Salt Neon.' - ) - known_hosts = recv_known_host_entries(hostname, enc, port, hash_known_hosts, timeout, fingerprint_hash_type) - return known_hosts[0] if known_hosts else None - - @salt.utils.decorators.path.which('ssh-keyscan') def recv_known_host_entries(hostname, enc=None, From 0bb3a7bc2cbb04359b3c2f23155eda40ed21530a Mon Sep 17 00:00:00 2001 From: ch3ll Date: Fri, 20 Dec 2019 14:51:55 -0500 Subject: [PATCH 2/3] remove dep notices in favor of #55715 --- doc/topics/releases/neon.rst | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/doc/topics/releases/neon.rst b/doc/topics/releases/neon.rst index 93cc2fe3c230..ff5be0003bfd 100644 --- a/doc/topics/releases/neon.rst +++ b/doc/topics/releases/neon.rst @@ -147,16 +147,6 @@ Module Deprecations - :py:func:`dockermod.load ` - :py:func:`dockermod.tag ` -- The :py:mod:`ssh ` execution module has been - changed as follows: - - - Support for the ``ssh.get_known_host`` function has been removed. Please use the - :py:func:`ssh.get_known_host_entries ` - function instead. - - Support for the ``ssh.recv_known_host`` function has been removed. Please use the - :py:func:`ssh.recv_known_host_entries ` - function instead. - State Deprecations ------------------ @@ -203,3 +193,4 @@ salt.auth.Authorize Class Removal - The salt.auth.Authorize Class inside of the `salt/auth/__init__.py` file has been removed and the `any_auth` method inside of the file `salt/utils/minions.py`. These method and classes were not being used inside of the salt code base. + From 134d04af4fc6ba0dfc32c1fecce8f5325be32988 Mon Sep 17 00:00:00 2001 From: ch3ll Date: Fri, 20 Dec 2019 14:53:12 -0500 Subject: [PATCH 3/3] remove unnecessary line --- doc/topics/releases/neon.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/topics/releases/neon.rst b/doc/topics/releases/neon.rst index ff5be0003bfd..0d19bf0d2888 100644 --- a/doc/topics/releases/neon.rst +++ b/doc/topics/releases/neon.rst @@ -193,4 +193,3 @@ salt.auth.Authorize Class Removal - The salt.auth.Authorize Class inside of the `salt/auth/__init__.py` file has been removed and the `any_auth` method inside of the file `salt/utils/minions.py`. These method and classes were not being used inside of the salt code base. -