From d22291d7e9310eeccb00d92a5b54d3695f135fc5 Mon Sep 17 00:00:00 2001 From: Sergey Kacheev Date: Sat, 16 Jul 2022 15:19:36 +0700 Subject: [PATCH] add deprecation warnings in salt/utils/zeromq.py:ip_bracket --- changelog/62009.deprecated | 1 + salt/utils/zeromq.py | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 changelog/62009.deprecated diff --git a/changelog/62009.deprecated b/changelog/62009.deprecated new file mode 100644 index 00000000000..e9455f07a7b --- /dev/null +++ b/changelog/62009.deprecated @@ -0,0 +1 @@ +The 'ip_bracket' function has been moved from salt/utils/zeromq.py in salt/utils/network.py diff --git a/salt/utils/zeromq.py b/salt/utils/zeromq.py index 9b4213b7a24..8aacc5f3817 100644 --- a/salt/utils/zeromq.py +++ b/salt/utils/zeromq.py @@ -4,7 +4,9 @@ ZMQ-specific functions import logging +import salt.utils.versions from salt.exceptions import SaltSystemExit +from salt.utils.network import ip_bracket as _new_ip_bracket log = logging.getLogger(__name__) @@ -27,8 +29,11 @@ except Exception: # pylint: disable=broad-except def check_ipc_path_max_len(uri): - # The socket path is limited to 107 characters on Solaris and - # Linux, and 103 characters on BSD-based systems. + """ + The socket path is limited to 107 characters on Solaris and + Linux, and 103 characters on BSD-based systems. + """ + if zmq is None: return ipc_path_max_len = getattr(zmq, "IPC_PATH_MAX_LEN", 103) @@ -40,3 +45,15 @@ def check_ipc_path_max_len(uri): "path or switch to TCP; in the configuration file, " 'set "ipc_mode: tcp".'.format(uri, ipc_path_max_len) ) + + +def ip_bracket(addr): + "This function has been moved to salt.utils.network.ip_bracket" + + salt.utils.versions.warn_until( + "Argon", + "The 'utils.zeromq.ip_bracket' has been moved to 'utils.network.ip_bracket'. " + "Please use 'utils.network.ip_bracket' because 'utils.zeromq.ip_bracket' " + "will be removed in future releases.", + ) + return _new_ip_bracket(addr)