zmq.IPC_PATH_MAX_LEN is not available in older ZMQ, only on PyZMQ>=2.2

This commit is contained in:
Pedro Algarvio 2013-01-26 20:02:14 +00:00
parent 6a6127176d
commit 55ab31cea7

View File

@ -803,13 +803,14 @@ def is_linux():
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.
if zmq.IPC_PATH_MAX_LEN and len(uri) > zmq.IPC_PATH_MAX_LEN:
ipc_path_max_len = getattr(zmq, 'IPC_PATH_MAX_LEN', 103)
if ipc_path_max_len and len(uri) > ipc_path_max_len:
raise SaltSystemExit(
'The socket path is longer than allowed by OS. '
'{0!r} is longer than {1} characters. '
'Either try to reduce the length of this setting\'s '
'path or switch to TCP; in the configuration file, '
'set "ipc_mode: tcp".'.format(
uri, zmq.IPC_PATH_MAX_LEN
uri, ipc_path_max_len
)
)