HEX
Server: Apache
System: Linux sg241.singhost.net 2.6.32-896.16.1.lve1.4.51.el6.x86_64 #1 SMP Wed Jan 17 13:19:23 EST 2018 x86_64
User: honghock (909)
PHP: 8.0.30
Disabled: passthru,system,shell_exec,show_source,exec,popen,proc_open
Upload Files
File: //usr/lib/python2.7/site-packages/salt/thorium/runner.py
# -*- coding: utf-8 -*-
'''
React by calling asynchronous runners
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
# import salt libs
import salt.runner


def cmd(
        name,
        func=None,
        arg=(),
        **kwargs):
    '''
    Execute a runner asynchronous:

    USAGE:

    .. code-block:: yaml

        run_cloud:
          runner.cmd:
            - func: cloud.create
            - arg:
                - my-ec2-config
                - myinstance

        run_cloud:
          runner.cmd:
            - func: cloud.create
            - kwargs:
                provider: my-ec2-config
                instances: myinstance
    '''
    ret = {'name': name,
           'changes': {},
           'comment': '',
           'result': True}
    if func is None:
        func = name
    local_opts = {}
    local_opts.update(__opts__)
    local_opts['async'] = True  # ensure this will be run asynchronous
    local_opts.update({
        'fun': func,
        'arg': arg,
        'kwarg': kwargs
    })
    runner = salt.runner.Runner(local_opts)
    runner.run()
    return ret