%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/slsutil.pyo

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddl	Zddl
Zeed�Z
dded�Zdded�Zddd	d
�Zd�Zd�Zd
�ZdS(u0
Utility functions for use with or in SLS files
i(tabsolute_importtunicode_literalstprint_functionNcC@stjjj||||�S(u3
    Merge ``upd`` recursively into ``dest``

    If ``merge_lists=True``, will aggregate list object types instead of
    replacing. This behavior is only activated when ``recursive_update=True``.

    CLI Example:

    .. code-block:: shell

        salt '*' slsutil.update '{foo: Foo}' '{bar: Bar}'

    (tsalttutilst
dictupdatetupdate(tdesttupdtrecursive_updatetmerge_lists((s8/usr/lib/python2.7/site-packages/salt/modules/slsutil.pyRsusmartuyamlcC@stjjj|||||�S(u
    Merge a data structure into another by choosing a merge strategy

    Strategies:

    * aggregate
    * list
    * overwrite
    * recurse
    * smart

    CLI Example:

    .. code-block:: shell

        salt '*' slsutil.merge '{foo: Foo}' '{bar: Bar}'
    (RRRtmerge(tobj_atobj_btstrategytrendererR
((s8/usr/lib/python2.7/site-packages/salt/modules/slsutil.pyR#scC@s<i}x/|D]'}tjjj|||||�}q
W|S(uv
    .. versionadded:: 2019.2.0

    Merge a list of objects into each other in order

    :type lst: Iterable
    :param lst: List of objects to be merged.

    :type strategy: String
    :param strategy: Merge strategy. See utils.dictupdate.

    :type renderer: String
    :param renderer:
        Renderer type. Used to determine strategy when strategy is 'smart'.

    :type merge_lists: Bool
    :param merge_lists: Defines whether to merge embedded object lists.

    CLI Example:

    .. code-block:: shell

        $ salt-call --output=txt slsutil.merge_all '[{foo: Foo}, {foo: Bar}]'
        local: {u'foo': u'Bar'}
    (RRRR(tlstRRR
trettobj((s8/usr/lib/python2.7/site-packages/salt/modules/slsutil.pyt	merge_all9s

u
jinja|yamlcK@s�|r#|r#tjjd��ntjjtt�}|rQtd|�}n|rjd}||d<ntjj|||tdtd|�}t	d|�r�|j
�S|S(u8
    Parse a string or file through Salt's renderer system

    .. versionchanged:: 2018.3.0
       Add support for Salt fileserver URIs.

    This is an open-ended function and can be used for a variety of tasks. It
    makes use of Salt's "renderer pipes" system to run a string or file through
    a pipe of any of the loaded renderer modules.

    :param path: The path to a file on Salt's fileserver (any URIs supported by
        :py:func:`cp.get_url <salt.modules.cp.get_url>`) or on the local file
        system.
    :param string: An inline string to be used as the file to send through the
        renderer system. Note, not all renderer modules can work with strings;
        the 'py' renderer requires a file, for example.
    :param default_renderer: The renderer pipe to send the file through; this
        is overridden by a "she-bang" at the top of the file.
    :param kwargs: Keyword args to pass to Salt's compile_template() function.

    Keep in mind the goal of each renderer when choosing a render-pipe; for
    example, the Jinja renderer processes a text file and produces a string,
    however the YAML renderer processes a text file and produces a data
    structure.

    One possible use is to allow writing "map files", as are commonly seen in
    Salt formulas, but without tying the renderer of the map file to the
    renderer used in the other sls files. In other words, a map file could use
    the Python renderer and still be included and used by an sls file that uses
    the default 'jinja|yaml' renderer.

    For example, the two following map files produce identical results but one
    is written using the normal 'jinja|yaml' and the other is using 'py':

    .. code-block:: jinja

        #!jinja|yaml
        {% set apache = salt.grains.filter_by({
            ...normal jinja map file here...
        }, merge=salt.pillar.get('apache:lookup')) %}
        {{ apache | yaml() }}

    .. code-block:: python

        #!py
        def run():
            apache = __salt__.grains.filter_by({
                ...normal map here but as a python dict...
            }, merge=__salt__.pillar.get('apache:lookup'))
            return apache

    Regardless of which of the above map files is used, it can be accessed from
    any other sls file by calling this function. The following is a usage
    example in Jinja:

    .. code-block:: jinja

        {% set apache = salt.slsutil.renderer('map.sls') %}

    CLI Example:

    .. code-block:: bash

        salt '*' slsutil.renderer salt://path/to/file
        salt '*' slsutil.renderer /path/to/file
        salt '*' slsutil.renderer /path/to/file.jinja 'jinja'
        salt '*' slsutil.renderer /path/to/file.sls 'jinja|yaml'
        salt '*' slsutil.renderer string='Inline template! {{ saltenv }}'
        salt '*' slsutil.renderer string='Hello, {{ name }}.' name='world'
    uMust pass either path or stringu
cp.get_urlu:string:u
input_dataurenderer_blacklisturenderer_whitelistustringio.is_readable(Rt
exceptionstSaltInvocationErrortloadertrendert__opts__t__salt__ttemplatetcompile_templatet	__utils__tread(tpathtstringtdefault_renderertkwargst	rendererstpath_or_stringR((s8/usr/lib/python2.7/site-packages/salt/modules/slsutil.pyR]s"G	
		cC@s�tjjt�}t||d�}t||d�}|sZtjjdj|���n|s�tjjdj||���n|S(NuSerializer '{0}' not found.u(Serializer '{0}' does not implement {1}.(	RRtserializersRtgetattrtNoneRtCommandExecutionErrortformat(t
serializertfn_nameR$tfnstfn((s8/usr/lib/python2.7/site-packages/salt/modules/slsutil.pyt_get_serialize_fn�s			cK@s+tjjj|�}t|d�||�S(ue
    Serialize a Python object using a :py:mod:`serializer module
    <salt.serializers>`

    CLI Example:

    .. code-block:: bash

        salt '*' --no-parse=obj slsutil.serialize 'json' obj="{'foo': 'Foo!'}

    Jinja Example:

    .. code-block:: jinja

        {% set json_string = salt.slsutil.serialize('json',
            {'foo': 'Foo!'}) %}
    u	serialize(RRtargstclean_kwargsR-(R)Rt
mod_kwargsR!((s8/usr/lib/python2.7/site-packages/salt/modules/slsutil.pyt	serialize�scK@s+tjjj|�}t|d�||�S(u�
    Deserialize a Python object using a :py:mod:`serializer module
    <salt.serializers>`

    CLI Example:

    .. code-block:: bash

        salt '*' slsutil.deserialize 'json' '{"foo": "Foo!"}'
        salt '*' --no-parse=stream_or_string slsutil.deserialize 'json' \
            stream_or_string='{"foo": "Foo!"}'

    Jinja Example:

    .. code-block:: jinja

        {% set python_object = salt.slsutil.deserialize('json',
            '{"foo": "Foo!"}') %}
    udeserialize(RRR.R/R-(R)tstream_or_stringR0R!((s8/usr/lib/python2.7/site-packages/salt/modules/slsutil.pytdeserialize�s(t__doc__t
__future__RRRtsalt.exceptionsRtsalt.loadert
salt.templatetsalt.utils.argstsalt.utils.dictupdatetTruetFalseRRRR&RR-R1R3(((s8/usr/lib/python2.7/site-packages/salt/modules/slsutil.pyt<module>s$^		

Zerion Mini Shell 1.0