Moving the check for an empty self.minions into a io_loop.call_later call.

This commit is contained in:
Gareth J. Greenaway 2018-09-25 09:34:14 -07:00
parent 44ee2ec25b
commit 04c5983676
No known key found for this signature in database
GPG key ID: 10B62F8A7CAD7A41

View file

@ -682,7 +682,6 @@ class MinionBase(object):
yield tornado.gen.sleep(opts['acceptance_wait_time'])
attempts += 1
if tries > 0:
log.debug(
'Connecting to master. Attempt %s of %s',
attempts, tries
@ -972,7 +971,17 @@ class MinionManager(MinionBase):
loaded_base_name=loaded_base_name,
jid_queue=jid_queue)
def _spawn_minions(self):
def _check_minions(self):
'''
Check the size of self.minions and raise an error if it's empty
'''
if not self.minions:
err = ('Minion unable to successfully connect to '
'a Salt Master. Exiting.')
log.error(err)
raise SaltSystemExit(code=42, msg=err)
def _spawn_minions(self, timeout=60):
'''
Spawn all the coroutines which will sign in to masters
'''
@ -993,12 +1002,7 @@ class MinionManager(MinionBase):
)
self._connect_minion(minion)
if not self.minions:
err = ('Minion unable to successfully connect to '
'a Salt Master. Exiting.')
log.error(err)
raise SaltSystemExit(code=42, msg=err)
self.io_loop.call_later(timeout, self._check_minions)
@tornado.gen.coroutine
def _connect_minion(self, minion):