Merge pull request #3466 from s0undt3ch/hotfix/zmq-ipc-path-max-length

`zmq.IPC_PATH_MAX_LEN` is not available in older ZMQ, only on PyZMQ>=2.2
This commit is contained in:
Thomas S Hatch 2013-01-26 12:27:32 -08:00
commit fa2f082e35

View File

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