MCPcopy Create free account
hub / github.com/saltstack/salt / zmq_version

Function zmq_version

salt/utils/verify.py:44–92  ·  view source on GitHub ↗

ZeroMQ python bindings >= 2.1.9 are required

()

Source from the content-addressed store, hash-verified

42
43
44def zmq_version():
45 """
46 ZeroMQ python bindings >= 2.1.9 are required
47 """
48 try:
49 import zmq
50 except Exception: # pylint: disable=broad-except
51 # Return True for local mode
52 return True
53 ver = zmq.__version__
54 # The last matched group can be None if the version
55 # is something like 3.1 and that will work properly
56 match = re.match(r"^(\d+)\.(\d+)(?:\.(\d+))?", ver)
57
58 # Fallthrough and hope for the best
59 if not match:
60 log.warning("Using untested zmq python bindings version: '%s'", ver)
61 return True
62
63 major, minor, point = match.groups()
64
65 if major.isdigit():
66 major = int(major)
67 if minor.isdigit():
68 minor = int(minor)
69
70 # point very well could be None
71 if point and point.isdigit():
72 point = int(point)
73
74 if major == 2 and minor == 1:
75 # zmq 2.1dev could be built against a newer libzmq
76 if "dev" in ver and not point:
77 log.warning("Using dev zmq module, please report unexpected results")
78 return True
79 elif point and point >= 9:
80 return True
81 elif major > 2 or (major == 2 and minor > 1):
82 return True
83
84 # If all else fails, gracefully croak and warn the user
85 log.critical("ZeroMQ python bindings >= 2.1.9 are required")
86 if "salt-master" in sys.argv[0]:
87 log.critical(
88 "The Salt Master is unstable using a ZeroMQ version "
89 "lower than 2.1.11 and requires this fix: http://lists.zeromq."
90 "org/pipermail/zeromq-dev/2011-June/012094.html"
91 )
92 return False
93
94
95def lookup_family(hostname):

Callers 2

verify_envFunction · 0.85
win_verify_envFunction · 0.85

Calls 2

warningMethod · 0.80
matchMethod · 0.45

Tested by

no test coverage detected