This function is called from a multiprocess instance, to wait for a minion
    to become available to receive salt commands

def check_auth(name, sock_dir=None, queue=None, timeout=300):
    '''
    This function is called from a multiprocess instance, to wait for a minion
    to become available to receive salt commands
    '''
    event = salt.utils.event.SaltEvent('master', sock_dir, listen=True)
    starttime = time.mktime(time.localtime())
    newtimeout = timeout
    log.debug('In check_auth, waiting for %s to become available', name)
    while newtimeout > 0:
        newtimeout = timeout - (time.mktime(time.localtime()) - starttime)
        ret = event.get_event(full=True)
        if ret is None:
            continue
        if ret['tag'] == 'salt/minion/{0}/start'.format(name):
            queue.put(name)
            newtimeout = 0
            log.debug('Minion %s is ready to receive commands', name)