add deprecation warnings in salt/utils/zeromq.py:ip_bracket

This commit is contained in:
Sergey Kacheev 2022-07-16 15:19:36 +07:00 committed by Megan Wilhite
parent 1163ef6bb2
commit d22291d7e9
2 changed files with 20 additions and 2 deletions

View file

@ -0,0 +1 @@
The 'ip_bracket' function has been moved from salt/utils/zeromq.py in salt/utils/network.py

View file

@ -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)