Refactor minion for single pre-tune-in routine. Resolves #10732

by setting _running in tune_in_no_block().
This commit is contained in:
Mike Place 2014-03-04 10:38:05 -07:00
parent 42e21d384b
commit 64802e207a

View File

@ -562,10 +562,7 @@ class MultiMinion(MinionBase):
minion['minion'].module_refresh() minion['minion'].module_refresh()
if pillar_refresh: if pillar_refresh:
minion['minion'].pillar_refresh() minion['minion'].pillar_refresh()
try: minion['generator'].next()
minion['generator'].next()
except StopIteration:
continue
class Minion(MinionBase): class Minion(MinionBase):
@ -1222,11 +1219,10 @@ class Minion(MinionBase):
self._running = False self._running = False
exit(0) exit(0)
# Main Minion Tune In def _pre_tune(self):
def tune_in(self):
''' '''
Lock onto the publisher. This is the main event loop for the minion Set the minion running flag and issue the appropriate warnings if
:rtype : None the minion cannot be started or is already running
''' '''
if self._running is None: if self._running is None:
self._running = True self._running = True
@ -1261,6 +1257,16 @@ class Minion(MinionBase):
exc_info=err exc_info=err
) )
# Main Minion Tune In
def tune_in(self):
'''
Lock onto the publisher. This is the main event loop for the minion
:rtype : None
'''
self._pre_tune()
# Properly exit if a SIGTERM is signalled # Properly exit if a SIGTERM is signalled
signal.signal(signal.SIGTERM, self.clean_die) signal.signal(signal.SIGTERM, self.clean_die)
@ -1367,6 +1373,8 @@ class Minion(MinionBase):
management of the event bus assuming that these are handled outside management of the event bus assuming that these are handled outside
the tune_in sequence the tune_in sequence
''' '''
self._pre_tune()
self._init_context_and_poller() self._init_context_and_poller()
self.socket = self.context.socket(zmq.SUB) self.socket = self.context.socket(zmq.SUB)