Use ZMQ_VERSION_INFO constant everywhere

This commit is contained in:
Bo Maryniuk 2018-02-15 10:33:25 +01:00
parent 43b5558b82
commit ab5fa34d7c
3 changed files with 4 additions and 23 deletions

View file

@ -28,7 +28,7 @@ except ImportError:
# pylint: disable=import-error,no-name-in-module,redefined-builtin
import salt.ext.six as six
from salt.ext.six.moves import range
from salt.utils.zeromq import zmq, ZMQDefaultLoop, install_zmq, zmq_version_info
from salt.utils.zeromq import zmq, ZMQDefaultLoop, install_zmq, ZMQ_VERSION_INFO
# pylint: enable=import-error,no-name-in-module,redefined-builtin
import tornado.gen # pylint: disable=F0401
@ -364,7 +364,7 @@ class Master(SMaster):
:param dict: The salt options
'''
if zmq and zmq_version_info < (3, 2):
if zmq and ZMQ_VERSION_INFO < (3, 2):
log.warning(
'You have a version of ZMQ less than ZMQ 3.2! There are '
'known connection keep-alive issues with ZMQ < 3.2 which '

View file

@ -30,7 +30,7 @@ if six.PY3:
else:
import salt.ext.ipaddress as ipaddress
from salt.ext.six.moves import range
from salt.utils.zeromq import zmq, ZMQDefaultLoop, install_zmq
from salt.utils.zeromq import zmq, ZMQDefaultLoop, install_zmq, ZMQ_VERSION_INFO
# pylint: enable=no-name-in-module,redefined-builtin
from salt.utils.async import LOOP_CLASS
@ -946,15 +946,7 @@ class Minion(MinionBase):
# Warn if ZMQ < 3.2
if zmq:
try:
zmq_version_info = zmq.zmq_version_info()
except AttributeError:
# PyZMQ <= 2.1.9 does not have zmq_version_info, fall back to
# using zmq.zmq_version() and build a version info tuple.
zmq_version_info = tuple(
[int(x) for x in zmq.zmq_version().split('.')] # pylint: disable=no-member
)
if zmq_version_info < (3, 2):
if ZMQ_VERSION_INFO < (3, 2):
log.warning(
'You have a version of ZMQ less than ZMQ 3.2! There are '
'known connection keep-alive issues with ZMQ < 3.2 which '

View file

@ -41,17 +41,6 @@ if ZMQDefaultLoop is None:
if ZMQDefaultLoop is None:
ZMQDefaultLoop = tornado.ioloop.IOLoop
# Build version info
if zmq:
if hasattr(zmq, 'zmq_version_info'):
zmq_version_info = zmq.zmq_version_info()
else:
# PyZMQ <= 2.1.9 does not have zmq_version_info, fall back to
# using zmq.zmq_version() and build a version info tuple.
zmq_version_info = tuple([int(v_el) for v_el in zmq.zmq_version().split('.')])
else:
zmq_version_info = (-1, -1, -1)
def install_zmq():
'''