

def renderer(path=None, string=None, default_renderer='jinja|yaml', **kwargs):
    '\n    Parse a string or file through Salt\'s renderer system\n\n    This is an open-ended function and can be used for a variety of tasks. It\n    makes use of Salt\'s "renderer pipes" system to run a string or file through\n    a pipe of any of the loaded renderer modules.\n\n    :param path: The path to a file on the filesystem.\n    :param string: An inline string to be used as the file to send through the\n        renderer system. Note, not all renderer modules can work with strings;\n        the \'py\' renderer requires a file, for example.\n    :param default_renderer: The renderer pipe to send the file through; this\n        is overridden by a "she-bang" at the top of the file.\n    :param kwargs: Keyword args to pass to Salt\'s compile_template() function.\n\n    Keep in mind the goal of each renderer when choosing a render-pipe; for\n    example, the Jinja renderer processes a text file and produces a string,\n    however the YAML renderer processes a text file and produces a data\n    structure.\n\n    One possible use is to allow writing "map files", as are commonly seen in\n    Salt formulas, but without tying the renderer of the map file to the\n    renderer used in the other sls files. In other words, a map file could use\n    the Python renderer and still be included and used by an sls file that uses\n    the default \'jinja|yaml\' renderer.\n\n    For example, the two following map files produce identical results but one\n    is written using the normal \'jinja|yaml\' and the other is using \'py\':\n\n    .. code-block:: jinja\n\n        #!jinja|yaml\n        {% set apache = salt.grains.filter_by({\n            ...normal jinja map file here...\n        }, merge=salt.pillar.get(\'apache:lookup\')) %}\n        {{ apache | yaml() }}\n\n    .. code-block:: python\n\n        #!py\n        def run():\n            apache = __salt__.grains.filter_by({\n                ...normal map here but as a python dict...\n            }, merge=__salt__.pillar.get(\'apache:lookup\'))\n            return apache\n\n    Regardless of which of the above map files is used, it can be accessed from\n    any other sls file by calling this function. The following is a usage\n    example in Jinja:\n\n    .. code-block:: jinja\n\n        {% set apache = salt.slsutil.renderer(\'map.sls\') %}\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt \'*\' slsutil.renderer /path/to/file\n        salt \'*\' slsutil.renderer /path/to/file.jinja \'jinja\'\n        salt \'*\' slsutil.renderer /path/to/file.sls \'jinja|yaml\'\n        salt \'*\' slsutil.renderer string=\'Inline template! {{ saltenv }}\'\n        salt \'*\' slsutil.renderer string=\'Hello, {{ name }}.\' name=\'world\'\n    '
    if ((not path) and (not string)):
        raise salt.exceptions.SaltInvocationError('Must pass either path or string')
    renderers = salt.loader.render(__opts__, __salt__)
    if path:
        path_or_string = path
    elif string:
        path_or_string = ':string:'
        kwargs['input_data'] = string
    return salt.template.compile_template(path_or_string, renderers, default_renderer, **kwargs)

dataset/ETHPy150Open saltstack/salt/salt/modules/slsutil.py renderer/original