def fire_master(data, tag, preload=None):
    if __opts__.get('local', None):
        #  We can't send an event if we're in masterless mode
        log.warning('Local mode detected. Event with tag {0} will NOT be sent.'.format(tag))
        return False
    if __opts__['transport'] == 'raet':
        channel = salt.transport.Channel.factory(__opts__)
        load = {'id': __opts__['id'],
                'tag': tag,
                'data': data,
                'cmd': '_minion_event'}
        try:
            channel.send(load)
        except Exception:
            pass
        return True

    if preload or __opts__.get('__cli') == 'salt-call':
        # If preload is specified, we must send a raw event (this is
        # slower because it has to independently authenticate)
        if 'master_uri' not in __opts__:
            __opts__['master_uri'] = 'tcp://{ip}:{port}'.format(
                    ip=salt.utils.ip_bracket(__opts__['interface']),
                    port=__opts__.get('ret_port', '4506')  # TODO, no fallback
                    )
        auth = salt.crypt.SAuth(__opts__)
        load = {'id': __opts__['id'],
                'tag': tag,
                'data': data,
                'tok': auth.gen_token('salt'),
                'cmd': '_minion_event'}

        if isinstance(preload, dict):
            load.update(preload)

        channel = salt.transport.Channel.factory(__opts__)
        try:
            channel.send(load)
        except Exception:
            pass
        return True
    else:
        # Usually, we can send the event via the minion, which is faster
        # because it is already authenticated
        try:
            return salt.utils.event.MinionEvent(__opts__, listen=False).fire_event(
                {'data': data, 'tag': tag, 'events': None, 'pretag': None}, 'fire_master')
        except Exception:
            exc_type, exc_value, exc_traceback = sys.exc_info()
            lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
            log.debug(lines)
            return False
The main handler. Dispatches to the user's code.
dataset/ETHPy150Open saltstack/salt/salt/modules/event.py/fire_master--crossover with--dataset/ETHPy150Open toastdriven/itty/itty.py/handle_request