Execute the salt call!
493496
def run(self):
        '''
        
        '''
        self.parse_args()

        if self.options.file_root:
            # check if the argument is pointing to a file on disk
            file_root = os.path.abspath(self.options.file_root)
            self.config['file_roots'] = {'base': _expand_glob_path([file_root])}

        if self.options.pillar_root:
            # check if the argument is pointing to a file on disk
            pillar_root = os.path.abspath(self.options.pillar_root)
            self.config['pillar_roots'] = {'base': _expand_glob_path([pillar_root])}

        if self.options.states_dir:
            # check if the argument is pointing to a file on disk
            states_dir = os.path.abspath(self.options.states_dir)
            self.config['states_dirs'] = [states_dir]

        if self.options.local:
            self.config['file_client'] = 'local'
        if self.options.master:
            self.config['master'] = self.options.master

        # Setup file logging!
        self.setup_logfile_logger()
        verify_log(self.config)

        caller = salt.cli.caller.Caller.factory(self.config)

        if self.options.doc:
            caller.print_docs()
            self.exit(salt.defaults.exitcodes.EX_OK)

        if self.options.grains_run:
            caller.print_grains()
            self.exit(salt.defaults.exitcodes.EX_OK)

        caller.run()
658870
public function executeCallback()
    {
        call_user_func_array(
            $this::getContainer()
                ->offsetGet('callback')
                ->get('action'),
            $this::getContainer()
                ->offsetGet('callback')
                ->get('params')
        );
    }
445341
function genSalt(opts, cb) {
    crypto.randomBytes(saltLength, function(err, buf) {
      opts.salt = buf;
      cb(err, opts);
    });
  }
1295773
def _call_apt(args, scope=True, **kwargs):
    '''
    
    '''
    cmd = []
    if scope and salt.utils.systemd.has_scope(__context__) and __salt__['config.get']('systemd.scope', True):
        cmd.extend(['systemd-run', '--scope'])
    cmd.extend(args)

    params = {'output_loglevel': 'trace',
              'python_shell': False,
              'env': salt.utils.environment.get_module_environment(globals())}
    params.update(kwargs)

    return __salt__['cmd.run_all'](cmd, **params)
306616
def prepare(self):
        '''
        
        '''
        super(SaltAPI, self).prepare()

        try:
            if self.config['verify_env']:
                logfile = self.config['log_file']
                if logfile is not None and not logfile.startswith(('tcp://',
                                                                   'udp://',
                                                                   'file://')):
                    # Logfile is not using Syslog, verify
                    with salt.utils.files.set_umask(0o027):
                        verify_files([logfile], self.config['user'])
        except OSError as err:
            log.exception('Failed to prepare salt environment')
            self.shutdown(err.errno)

        self.setup_logfile_logger()
        verify_log(self.config)
        log.info('Setting up the Salt API')
        self.api = salt.client.netapi.NetapiClient(self.config)
        self.daemonize_if_required()
        self.set_pidfile()
655293
function executeHooks(data, allHooks, checkHooks, creationMode) {
    var hooksToCall = creationMode ? allHooks : checkHooks;
    if (hooksToCall) {
        callHooks(data, hooksToCall);
    }
}
28723
function execute(req, res) {
  req.conn.monitor(this);
  res.send(null, Constants.OK);
}
269348
def _handle_tag_salt_error(self, tag, data):
        '''
        
        '''
        if self.connected:
            log.debug('Forwarding salt error event tag=%s', tag)
            self._fire_master(data, tag)
460746
function execute(req, res) {
  // TODO: ensure a conflict is triggered on all watched keys
  this.store.flushall();
  res.send(null, Constants.OK);
}
28276
def send_event_to_salt(self, result):
        '''
        

        '''
        if result['send']:
            data = result['data']
            topic = result['topic']
            # If the engine is run on master, get the event bus and send the
            # parsed event.
            if __opts__['__role'] == 'master':
                event.get_master_event(__opts__,
                                       __opts__['sock_dir']
                                       ).fire_event(data, topic)
            # If the engine is run on minion, use the fire_master execution
            # module to send event on the master bus.
            else:
                __salt__['event.fire_master'](data=data, tag=topic)
95707
def salt_extend(extension, name, description, salt_dir, merge):
    '''
    
    '''
    import salt.utils.extend
    salt.utils.extend.run(extension=extension,
                          name=name,
                          description=description,
                          salt_dir=salt_dir,
                          merge=merge)
252372
def run_chunk(environ, lowstate):
    '''
    
    '''
    client = environ['SALT_APIClient']

    for chunk in lowstate:
        yield client.run(chunk)
556225
function pump(p) {
  function push() {
    if (p.sendToQueue(p.qName, message)) {
      ++totalPushed;
      setTimeout(push, pushback);
    }
  }
  push();
}
385630
def run(self):
        '''
        
        '''
        salt.utils.process.appendproctitle(self.__class__.__name__)
        self.io_loop = tornado.ioloop.IOLoop()
        with salt.utils.asynchronous.current_ioloop(self.io_loop):
            if self.opts['ipc_mode'] == 'tcp':
                epub_uri = int(self.opts['tcp_master_pub_port'])
                epull_uri = int(self.opts['tcp_master_pull_port'])
            else:
                epub_uri = os.path.join(
                    self.opts['sock_dir'],
                    'master_event_pub.ipc'
                )
                epull_uri = os.path.join(
                    self.opts['sock_dir'],
                    'master_event_pull.ipc'
                )

            self.publisher = salt.transport.ipc.IPCMessagePublisher(
                self.opts,
                epub_uri,
                io_loop=self.io_loop
            )

            self.puller = salt.transport.ipc.IPCMessageServer(
                self.opts,
                epull_uri,
                io_loop=self.io_loop,
                payload_handler=self.handle_publish,
            )

            # Start the master event publisher
            with salt.utils.files.set_umask(0o177):
                self.publisher.start()
                self.puller.start()
                if (self.opts['ipc_mode'] != 'tcp' and (
                        self.opts['publisher_acl'] or
                        self.opts['external_auth'])):
                    os.chmod(os.path.join(
                        self.opts['sock_dir'], 'master_event_pub.ipc'), 0o666)

            # Make sure the IO loop and respective sockets are closed and
            # destroyed
            Finalize(self, self.close, exitpriority=15)

            self.io_loop.start()
295734
def run(self, low):
        '''
        
        '''
        # Eauth currently requires a running daemon and commands run through
        # this method require eauth so perform a quick check to raise a
        # more meaningful error.
        if not self._is_master_running():
            raise salt.exceptions.SaltDaemonNotRunning(
                    'Salt Master is not available.')

        if low.get('client') not in CLIENTS:
            raise salt.exceptions.SaltInvocationError(
                    'Invalid client specified: \'{0}\''.format(low.get('client')))

        if not ('token' in low or 'eauth' in low) and low['client'] != 'ssh':
            raise salt.exceptions.EauthAuthenticationError(
                    'No authentication credentials given')

        l_fun = getattr(self, low['client'])
        f_call = salt.utils.args.format_call(l_fun, low)
        return l_fun(*f_call.get('args', ()), **f_call.get('kwargs', {}))
783870
def fire_exception(exc, opts, job=None, node='minion'):
    '''
    
    '''
    if job is None:
        job = {}
    event = salt.utils.event.SaltEvent(node, opts=opts, listen=False)
    event.fire_event(pack_exception(exc), '_salt_error')
805048
def salt_syndic():
    '''
    
    '''
    import salt.utils.process
    salt.utils.process.notify_systemd()

    import salt.cli.daemons
    pid = os.getpid()
    try:
        syndic = salt.cli.daemons.Syndic()
        syndic.start()
    except KeyboardInterrupt:
        os.kill(pid, 15)