Merge pull request #16344 from thatch45/gate_zmq

gate the zmq call
This commit is contained in:
Thomas S Hatch 2014-10-03 00:09:23 -06:00
commit 34cb47c7b3

View File

@ -46,8 +46,9 @@ from salt.exceptions import (
# Import third party libs
try:
import zmq
HAS_ZMQ = True
except ImportError:
pass
HAS_ZMQ = False
# Try to import range from https://github.com/ytoolshed/range
HAS_RANGE = False
@ -791,17 +792,24 @@ class LocalClient(object):
if event is None:
event = self.event
while True:
try:
if HAS_ZMQ:
try:
raw = event.get_event_noblock()
if raw and raw.get('tag', '').startswith(jid):
yield raw
else:
yield None
except zmq.ZMQError as ex:
if ex.errno == errno.EAGAIN or ex.errno == errno.EINTR:
yield None
else:
raise
else:
raw = event.get_event_noblock()
if raw and raw.get('tag', '').startswith(jid):
yield raw
else:
yield None
except zmq.ZMQError as ex:
if ex.errno == errno.EAGAIN or ex.errno == errno.EINTR:
yield None
else:
raise
def get_iter_returns(
self,