we need to be more careful when making the SMinion

The SMinion is often used by backends like the salt client and api
this change relies more heavily on the pyzmq components to resolve
and return the correct loop, and only create the loop if needed.
This commit is contained in:
Thomas S Hatch 2016-07-05 11:09:56 -06:00
parent 7508d291d2
commit edd6b95c60

View file

@ -585,9 +585,10 @@ class SMinion(MinionBase):
# Clean out the proc directory (default /var/cache/salt/minion/proc)
if (self.opts.get('file_client', 'remote') == 'remote'
or self.opts.get('use_master_when_local', False)):
if HAS_ZMQ:
zmq.eventloop.ioloop.install()
io_loop = LOOP_CLASS.current()
if self.opts['transport'] == 'zeromq' and HAS_ZMQ:
io_loop = zmq.eventloop.ioloop.ZMQIOLoop()
else:
io_loop = LOOP_CLASS.current()
io_loop.run_sync(
lambda: self.eval_master(self.opts, failed=True)
)