%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/utils/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/utils/jinja.pyc

�
���^c@@sdZddlmZmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZddlmZddlmZmZmZddlZddlmZddlmZmZmZmZdd	lmZdd
lmZddl m!Z!ddl"m#Z#ddl$Z%ddl&Z%ddl'Z%ddl(Z%ddl)Z%ddl*Z%ddl+Z%dd
l,m-Z-m.Z.m/Z/ddl0m1Z1ej2e3�Z4ddgZ5ej6d�Z7defd��YZ8ej9e8j:�de1fd��YZ;e/d�d��Z<e.d�e=e=d��Z>e.d�d��Z?e-d�d��Z@e-d�d��ZAe-d �d!��ZBe-d"�dd#��ZDe-d$�d%��ZEe-�d&��ZFe-d'�e=e=d(��ZGe-d)�e=e=d*��ZHe-d+�e=e=d,��ZIe-d-�d.��ZJe-�d/��ZKe-d0�d1��ZLe-d2�d3��ZMe-d4�d5��ZNe-d6�d7��ZOe-d8�d9��ZPe-d:�d;��ZQe-d<�d=��ZRejSd>��ZTd?e!eUfd@��YZVdS(AuK
Jinja loading utils to enable a more powerful backend for jinja templates
i(tabsolute_importtunicode_literalsN(twraps(tminidom(tElementt
SubElementttostring(tsix(t
BaseLoadertMarkuptTemplateNotFoundtnodes(tTemplateModule(tTemplateRuntimeError(t	Extension(t
TemplateError(tjinja_filtert
jinja_testtjinja_global(tOrderedDictuSaltCacheLoaderuSerializerExtensionu$91633EBF-1C86-5E33-935A-28061F4B480EtSaltCacheLoadercB@sbeZdZd	Zd	Zed��Zdded	d�Z	d�Z
d�Zd�Zd�Z
RS(
u�
    A special jinja Template Loader for salt.
    Requested templates are always fetched from the server
    to guarantee that the file is up to date.
    Templates are cached like regular salt states
    and only loaded once per loader instance.
    cC@sbx[dD]S}t||d�}|dk	rt|d�rG|j�nt||d�qqWdS(Nu_cached_clientu_cached_pillar_clientudestroy(u_cached_clientu_cached_pillar_client(tgetattrtNonethasattrtdestroytsetattr(tclstattrtclient((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pytshutdown>s

ubaseuutf-8cC@s�||_||_||_||_|jr`||jdkrLg|_q�|d||_n"tjj|dd|�g|_tj	d|j�g|_
||_|j�dS(Nupillar_rootsucachedirufilesuJinja search path: %s(
toptstsaltenvtencodingtpillar_rendt
searchpathtostpathtjointlogtdebugtcachedt_file_clienttfile_client(tselfRRR R!R)((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyt__init__Hs					"		cC@s�|jdkr||jrdnd}t||d�}|dkrptjj|j|j�}tt	||�n||_n|jS(uC
        Return a file client. Instantiates on first call.
        u_cached_pillar_clientu_cached_clientN(
R)RR!Rtsaltt
fileclienttget_file_clientRRR(R+Rt
cached_client((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyR*[scC@s8tjjj|�}|j�j|dt|j�dS(u3
        Cache a file from the salt master
        uN(R-tutilsturltcreateR*tget_filetTrueR(R+ttemplatetsaltpath((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyt
cache_filekscC@s3||jkr/|j|�|jj|�ndS(u(
        Cache a file only once
        N(R(R8tappend(R+R6((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pytcheck_cachers
c

@s=|}|jdd�ddkr+t}nt}|r�|sMd|jkrftjd|�t�n|jd}tjj	dj
||f��}|jdd�ddkr�tjd|�t|��q�n|j|�|r|rtjj|�j
d	d�}|}|r3|jjd|�}|}ni|d
6|dkrOdn|d6|j
dd�d6}|jj|�nx�|jD]�}	tjj
|	|��yntjjj�d
��P}
|
j�j|j�}tjj�����fd�}|�|fSWdQXWq�tk
r(q�q�Xq�Wt|��dS(u{
        Salt-specific loader to find imported jinja files.

        Jinja imports will be interpreted as originating from the top
        of each of the directories in the searchpath when the template
        name does not begin with './' or '../'.  When a template name
        begins with './' or '../' then the import will be relative to
        the importing file.

        u/iiu..u.utpldiru<Relative path "%s" cannot be resolved without an environmentuCDiscarded template path "%s": attempts to ascend outside of salt://u\utplfileuutpldoturbc@s3ytjj���kSWntk
r.tSXdS(N(R#R$tgetmtimetOSErrortFalse((tfilepathtmtime(s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pytuptodate�s
N(u..u.(tsplitR5R=tglobalsR&twarningR
R#R$tnormpathR%R:tdirnametreplacetgettupdateR"R-R1tfilestfopentreadtdecodeR R;tIOError(
R+tenvironmentR6t	_templatetis_relativet	base_pathttpldirttplfilettpldatatspathtifiletcontentsR@((R>R?s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyt
get_sourcezsP		
!
	
N(t__name__t
__module__t__doc__Rt_cached_pillar_clientt_cached_clienttclassmethodRR=R,R*R8R:RX(((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyR2s
			t
PrintableDictcB@s eZdZd�Zd�ZRS(u@
    Ensures that dict str() and repr() are YAML friendly.

    .. code-block:: python

        mapping = OrderedDict([('a', 'b'), ('c', None)])
        print mapping
        # OrderedDict([('a', 'b'), ('c', None)])

        decorated = PrintableDict(mapping)
        print decorated
        # {'a': 'b', 'c': None}
    cC@s�g}xdtj|�D]S\}}t|tj�rP|jdj||��q|jdj||��qWddj|�dS(Nu{0!r}: {1!r}u{0!r}: {1!s}u{u, u}(Rt	iteritemst
isinstancetstring_typesR9tformatR%(R+toutputtkeytvalue((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyt__str__�scC@sTg}x6tj|�D]%\}}|jdj||��qWddj|�dS(Nu{0!r}: {1!r}u{u, u}(RR`R9RcR%(R+RdReRf((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyt__repr__�s(RYRZR[RgRh(((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyR_�s
	uraisecC@st|��dS(N(R(tmsg((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pytjinja_raise�sumatchcC@s[d}|r|tjO}n|r2|tjO}ntj||�}|j|�rWtStS(u6Returns true if a sequence of chars matches a pattern.i(tretItMtcompiletmatchR5R=(ttxttrgxt
ignorecaset	multilinetflagtcompiled_rgx((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyt
test_match�suequaltocC@s
||kS(u%Returns true if two values are equal.((Rftother((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyttest_equalto�suskipcC@sdS(u�
    Suppress data output

    .. code-block:: yaml

        {% my_string = "foo" %}

        {{ my_string|skip }}

    will be rendered as empty string,

    u((tdata((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pytskip_filtersusequencecC@s&t|ttttf�s"|gS|S(u�
    Ensure sequenced data.

    **sequence**

        ensure that parsed data is a sequence

    .. code-block:: jinja

        {% set my_string = "foo" %}
        {% set my_list = ["bar", ] %}
        {% set my_dict = {"baz": "qux"} %}

        {{ my_string|sequence|first }}
        {{ my_list|sequence|first }}
        {{ my_dict|sequence|first }}


    will be rendered as:

    .. code-block:: yaml

        foo
        bar
        baz
    (Ratlistttupletsettdict(Ry((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pytensure_sequence_filtersuto_boolcC@s�|dkrtSt|t�r#|St|tjtjf�rN|j�dkSt|tj�rj|dkSt|t	j
�s�t|�dkStS(u�
    Returns the logical value.

    .. code-block:: jinja

        {{ 'yes' | to_bool }}

    will be rendered as:

    .. code-block:: text

        True
    uyesu1utrueiN(uyesu1utrue(RR=RatboolRt	text_typeRbtlowert
integer_typestcollectionstHashabletlen(tval((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pytto_bool5s
utojsoncC@slitd6}|dk	r&||d<ntjjj||�jdd�jdd�jdd�jd	d
�S(u�
    Implementation of tojson filter (only present in Jinja 2.9 and later). If
    Jinja 2.9 or later is installed, then the upstream version of this filter
    will be used.
    uensure_asciiuindentu<u\u003cu>u\u003eu&u\u0026u'u\u0027N(R5RR-R1tjsontdumpsRF(R�tindenttoptions((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyttojsonQs

uquotecC@s
tj|�S(u�
    Wraps a text around quotes.

    .. code-block:: jinja

        {% set my_text = 'my_text' %}
        {{ my_text | quote }}

    will be rendered as:

    .. code-block:: text

        'my_text'
    (tpipestquote(Rp((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyR�escC@s
tj|�S(N(Rktescape(Rf((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pytregex_escapexsuregex_searchcC@s[d}|r|tjO}n|r2|tjO}ntj|||�}|sQdS|j�S(u�
    Searches for a pattern in the text.

    .. code-block:: jinja

        {% set my_text = 'abcd' %}
        {{ my_text | regex_search('^(.*)BC(.*)$', ignorecase=True) }}

    will be rendered as:

    .. code-block:: text

        ('a', 'd')
    iN(RkRlRmtsearchtgroups(RpRqRrRsRttobj((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pytregex_search}suregex_matchcC@s[d}|r|tjO}n|r2|tjO}ntj|||�}|sQdS|j�S(u�
    Searches for a pattern in the text.

    .. code-block:: jinja

        {% set my_text = 'abcd' %}
        {{ my_text | regex_match('^(.*)BC(.*)$', ignorecase=True) }}

    will be rendered as:

    .. code-block:: text

        ('a', 'd')
    iN(RkRlRmRoR�(RpRqRrRsRtR�((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pytregex_match�su
regex_replacecC@sTd}|r|tjO}n|r2|tjO}ntj||�}|j||�S(u 
    Searches for a pattern and replaces with a sequence of characters.

    .. code-block:: jinja

        {% set my_text = 'lets replace spaces' %}
        {{ my_text | regex_replace('\s+', '__') }}

    will be rendered as:

    .. code-block:: text

        lets__replace__spaces
    i(RkRlRmRntsub(RpRqR�RrRsRtRu((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyt
regex_replace�suuuidcC@s(tjtjttjjj|���S(u�
    Returns a UUID corresponding to the value passed as argument.

    .. code-block:: jinja

        {{ 'example' | uuid }}

    will be rendered as:

    .. code-block:: text

        f4efeff8-c219-578a-bad7-3dc280612ec8
    (	RR�tuuidtuuid5tGLOBAL_UUIDR-R1tstringutilstto_str(R�((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pytuuid_�scC@s^d}t|tj�r't|�}n3g}x*|D]"}||kr4|j|�q4q4W|S(u�
    Removes duplicates from a list.

    .. code-block:: jinja

        {% set my_list = ['a', 'b', 'c', 'a', 'b'] -%}
        {{ my_list | unique }}

    will be rendered as:

    .. code-block:: text

        ['a', 'b', 'c']
    N(RRaR�R�R}R9(tvaluestretRf((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pytunique�s
umincC@s
t|�S(u�
    Returns the min value.

    .. code-block:: jinja

        {% set my_list = [1,2,3,4] -%}
        {{ my_list | min }}

    will be rendered as:

    .. code-block:: text

        1
    (tmin(R�((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pytlst_minsumaxcC@s
t|�S(u�
    Returns the max value.

    .. code-block:: jinja

        {% my_list = [1,2,3,4] -%}
        {{ set my_list | max }}

    will be rendered as:

    .. code-block:: text

        4
    (tmax(R�((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pytlst_maxsuavgcC@sRtjjjdddd�t|tj�sHtt|�t	|��St|�S(u�
    Returns the average value of a list.

    .. code-block:: jinja

        {% my_list = [1,2,3,4] -%}
        {{ set my_list | avg }}

    will be rendered as:

    .. code-block:: yaml

        2.5
    uNeonu�This results of this function are currently being rounded.Beginning in the Salt Neon release, results will no longer be rounded and this warning will be removed.t
stackleveli(
R-R1tversionst
warn_untilRaR�R�tfloattsumR�(tlst((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pytlst_avg'suunioncC@sFt|tj�r8t|tj�r8t|�t|�BSt||�S(u�
    Returns the union of two lists.

    .. code-block:: jinja

        {% my_list = [1,2,3,4] -%}
        {{ set my_list | union([2, 4, 6]) }}

    will be rendered as:

    .. code-block:: text

        [1, 2, 3, 4, 6]
    (RaR�R�R}R�(tlst1tlst2((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pytunionDs$u	intersectcC@sat|tj�r8t|tj�r8t|�t|�@Stg|D]}||krB|^qB�S(u�
    Returns the intersection of two lists.

    .. code-block:: jinja

        {% my_list = [1,2,3,4] -%}
        {{ set my_list | intersect([2, 4, 6]) }}

    will be rendered as:

    .. code-block:: text

        [2, 4]
    (RaR�R�R}R�(R�R�tele((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyt	intersectYs$u
differencecC@sat|tj�r8t|tj�r8t|�t|�Stg|D]}||krB|^qB�S(u�
    Returns the difference of two lists.

    .. code-block:: jinja

        {% my_list = [1,2,3,4] -%}
        {{ set my_list | difference([2, 4, 6]) }}

    will be rendered as:

    .. code-block:: text

        [1, 3, 6]
    (RaR�R�R}R�(R�R�R�((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyt
differencens$usymmetric_differencecC@sst|tj�r8t|tj�r8t|�t|�AStgt||�D]!}|t||�krK|^qK�S(u�
    Returns the symmetric difference of two lists.

    .. code-block:: jinja

        {% my_list = [1,2,3,4] -%}
        {{ set my_list | symmetric_difference([2, 4, 6]) }}

    will be rendered as:

    .. code-block:: text

        [1, 3]
    (RaR�R�R}R�R�R�(R�R�R�((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pytsymmetric_difference�s$cC@s#tjjjd�|j�D��S(NcS@si|]\}}||�qS(((t.0ReRf((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pys
<dictcomp>�s	(R-R1Rytsimple_types_filtertitems(tctx((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pytshow_full_context�stSerializerExtensioncB@s�eZdZddddddhZd�Zd�Zedd	�Zed
�Z	d�Z
d�Zd
�Zd�Z
d�ZdddhZd�Zd�Zd�Zd�Zd�ZRS(uf
    Yaml and Json manipulation.

    **Format filters**

    Allows jsonifying or yamlifying any data structure. For example, this dataset:

    .. code-block:: python

        data = {
            'foo': True,
            'bar': 42,
            'baz': [1, 2, 3],
            'qux': 2.0
        }

    .. code-block:: jinja

        yaml = {{ data|yaml }}
        json = {{ data|json }}
        python = {{ data|python }}
        xml  = {{ {'root_node': data}|xml }}

    will be rendered as::

        yaml = {bar: 42, baz: [1, 2, 3], foo: true, qux: 2.0}
        json = {"baz": [1, 2, 3], "foo": true, "bar": 42, "qux": 2.0}
        python = {'bar': 42, 'baz': [1, 2, 3], 'foo': True, 'qux': 2.0}
        xml = """<<?xml version="1.0" ?>
                 <root_node bar="42" foo="True" qux="2.0">
                  <baz>1</baz>
                  <baz>2</baz>
                  <baz>3</baz>
                 </root_node>"""

    The yaml filter takes an optional flow_style parameter to control the
    default-flow-style parameter of the YAML dumper.

    .. code-block:: jinja

        {{ data|yaml(False) }}

    will be rendered as:

    .. code-block:: yaml

        bar: 42
        baz:
          - 1
          - 2
          - 3
        foo: true
        qux: 2.0

    **Load filters**

    Strings and variables can be deserialized with **load_yaml** and
    **load_json** tags and filters. It allows one to manipulate data directly
    in templates, easily:

    .. code-block:: jinja

        {%- set yaml_src = "{foo: it works}"|load_yaml %}
        {%- set json_src = "{'bar': 'for real'}"|load_json %}
        Dude, {{ yaml_src.foo }} {{ json_src.bar }}!

    will be rendered as::

        Dude, it works for real!

    **Load tags**

    Salt implements ``load_yaml`` and ``load_json`` tags. They work like
    the `import tag`_, except that the document is also deserialized.

    Syntaxes are ``{% load_yaml as [VARIABLE] %}[YOUR DATA]{% endload %}``
    and ``{% load_json as [VARIABLE] %}[YOUR DATA]{% endload %}``

    For example:

    .. code-block:: jinja

        {% load_yaml as yaml_src %}
            foo: it works
        {% endload %}
        {% load_json as json_src %}
            {
                "bar": "for real"
            }
        {% endload %}
        Dude, {{ yaml_src.foo }} {{ json_src.bar }}!

    will be rendered as::

        Dude, it works for real!

    **Import tags**

    External files can be imported and made available as a Jinja variable.

    .. code-block:: jinja

        {% import_yaml "myfile.yml" as myfile %}
        {% import_json "defaults.json" as defaults %}
        {% import_text "completeworksofshakespeare.txt" as poems %}

    **Catalog**

    ``import_*`` and ``load_*`` tags will automatically expose their
    target variable to import. This feature makes catalog of data to
    handle.

    for example:

    .. code-block:: jinja

        # doc1.sls
        {% load_yaml as var1 %}
            foo: it works
        {% endload %}
        {% load_yaml as var2 %}
            bar: for real
        {% endload %}

    .. code-block:: jinja

        # doc2.sls
        {% from "doc1.sls" import var1, var2 as local2 %}
        {{ var1.foo }} {{ local2.bar }}

    ** Escape Filters **

    .. versionadded:: 2017.7.0

    Allows escaping of strings so they can be interpreted literally by another
    function.

    For example:

    .. code-block:: jinja

        regex_escape = {{ 'https://example.com?foo=bar%20baz' | regex_escape }}

    will be rendered as::

        regex_escape = https\:\/\/example\.com\?foo\=bar\%20baz

    ** Set Theory Filters **

    .. versionadded:: 2017.7.0

    Performs set math using Jinja filters.

    For example:

    .. code-block:: jinja

        unique = {{ ['foo', 'foo', 'bar'] | unique }}

    will be rendered as::

        unique = ['foo', 'bar']

    .. _`import tag`: http://jinja.pocoo.org/docs/templates/#import
    u	load_yamlu	load_jsonuimport_yamluimport_jsonu	load_textuimport_textc@s�tt|�j|�|jjji|jd6|jd6|jd6|j	d6|j
d6|jd6|jd6�|jj
dkr�|j|j_
n3|jj
�t���fd��}||j_
dS(	Nuyamlujsonuxmlupythonu	load_yamlu	load_jsonu	load_textc@s�|j|��S(N(t	finalizer(R+Ry(R�(s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pytwrapperWs(tsuperR�R,RNtfiltersRHtformat_yamltformat_jsont
format_xmlt
format_pythont	load_yamlt	load_jsont	load_texttfinalizeRR�R(R+RNR�((R�s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyR,Fs





c@s�fd���|�S(uA
        Ensure that printed mappings are YAML friendly.
        c@s�t|ttf�rMtgtj|�D]\}}|�|�f^q(�St|tttf�r�|j	g|D]}�|�^qr�S|S(N(
RaR~RR_RR`R{R|R}t	__class__(RyReRf(texplore(s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyR�`s5&((R+Ry((R�s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyR�\scC@sctjjj|d|d|�j�}yt|�SWn'tk
r^ttjjj|��SXdS(Nt	sort_keysR�(	R-R1R�R�tstripR	tUnicodeDecodeErrorR�t
to_unicode(R+RfR�R�tjson_txt((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyR�js
'
cC@s�tjjj|d|�j�}|jtd��rM|t|�d }nyt|�SWn't	k
r�ttjj
j|��SXdS(Ntdefault_flow_styleu
...i(R-R1tyamlt	safe_dumpR�tendswithtstrR�R	R�R�R�(R+Rft
flow_styletyaml_txt((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyR�qs
c@sOd��d��fd��ttjt��|����jdd��S(u9Render a formatted multi-line XML string from a complex Python
        data structure. Supports tag attributes and nested dicts/lists.

        :param value: Complex data structure representing XML contents
        :returns: Formatted XML string rendered with newlines and indentation
        :rtype: str
        cS@snt|ttf�r:t|dt�r1|}qjg}n0t|t�r^t|j��}ntd��|S(Niu1Value is not a dict or list. Cannot render as XML(RaR{R|R�R~R�R
(Rftxmlval((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pytnormalize_iter�s			c@sAd}x4|D],\}}t|t�rRxQ|D]}�||ff|�q/Wn*|dk	rpt||�}nt|�}t|ttttf�r�t	j
|�|_q
nt|t�r�d�|j
�D�|_nx\g�|�D]%}t|dttf�r�|^q�D]"\}}�||ff|�qWq
W|S(NcS@s=i|]3\}}t|ttf�stj|�|�qS((RaR~R{RR�(R�RR�((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pys
<dictcomp>�s		i(RRaR{RRR�tintR�R�RR�ttextR~R�tattrib(txmlitertelementR�ttagtattrsRtitemR�(R�trecurse_tree(s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyR��s"
/R�u N(RR	RtparseStringRttoprettyxml(R+Rf((R�R�s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyR�{s
	
	cC@sttj|�j��S(N(R	tpprinttpformatR�(R+Rf((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyR��scC@s&t|t�r!tj|�}ny&tjjjtjjj	|��SWn�tjjj
k
r�}d}y)|jjd}|jj
}|j}Wn$tk
r�|tj|�7}n6X|dj|�7}|tjjj||dd�7}t|��n&tk
r!tdj|���nXdS(Nu Encountered error loading yaml: iu{0}
tmarkeru    <======================uUnable to load yaml from {0}(RaRRR�R-R1RyRLR�t	safe_loadt	YAMLErrortproblem_marktlinetbuffertproblemtAttributeErrorRcR�tget_contextR
(R+RftexcRiR�tbufR�((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyR��s*&



cC@snt|t�r!tj|�}nytjjj|�SWn/tt	t
fk
ritdj|���nXdS(NuUnable to load json from {0}(
RaRRR�R-R1R�tloadst
ValueErrort	TypeErrorR�R
Rc(R+Rf((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyR��scC@s%t|t�r!tj|�}n|S(N(RaRRR�(R+Rf((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyR��scC@s�|jjjdkr"|j|�S|jjjdkrD|j|�S|jjjdkrf|j|�S|jjj|jkr�|j|�S|jd|jjj|jjj	�dS(Nuimport_yamluimport_jsonuimport_textuUnknown format (
tstreamtcurrentRft
parse_yamlt
parse_jsont
parse_textt
_load_parserst
parse_loadtfailtlineno(R+tparser((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pytparse�s



c
C@s!|jjj}t|j�j}||jjkrO|jdj|�|�n|jj	d�|j
�}d|j�j}|j
ddt�}tj|gg|�j|�tj|tjtjtj|d�j|�ggdd�j|�|ggdd�j|��j|�gS(NuUnable to parse {0}uname:asu_uname:endloadtdrop_needleuload(uname:endload(R�R�RftnextR�RNR�R�Rctexpecttparse_assign_targettfree_identifiertnametparse_statementsR5RtMacrot
set_linenotAssigntFiltertCalltNameR(R+R�tfilter_nameR�ttargett
macro_namet
macro_body((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyR��s@			c
C@s�|j�}|j}|j}|tjtj|d�j|�tjtj|d�j|�dggdd�j|��j|�gS(Nustoreuloadu	load_yaml(	tparse_importR
R�RRRRRR(R+R�timport_nodeR
R�((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyR�s			c
C@s�|j�}|j}|j}|tjtj|d�j|�tjtj|d�j|�dggdd�j|��j|�gS(Nustoreuloadu	load_json(	R
R
R�RRRRRR(R+R�RR
R�((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyR�!s			c
C@s�|j�}|j}|j}|tjtj|d�j|�tjtj|d�j|�dggdd�j|��j|�gS(Nustoreuloadu	load_text(	R
R
R�RRRRRR(R+R�RR
R�((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyR�6s			N(RYRZR[ttagsR,R�R5RR�R�R�R�R�R�R�R�R�R�R�R�R�(((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyR��s"�		
	.							&		(WR[t
__future__RRtatexitR�tloggingtos.pathR#R�R�RkR�t	functoolsRtxml.domRtxml.etree.ElementTreeRRRtjinja2tsalt.extRRR	R
Rtjinja2.environmentRtjinja2.exceptionsR
t
jinja2.extRtsalt.exceptionsRtsalt.fileclientR-tsalt.utils.datatsalt.utils.filestsalt.utils.jsontsalt.utils.stringutilstsalt.utils.urltsalt.utils.yamltsalt.utils.decorators.jinjaRRRtsalt.utils.odictRt	getLoggerRYR&t__all__tUUIDR�RtregisterRR_RjR=RvRxRzRR�RR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�tcontextfunctionR�tobjectR�(((s4/usr/lib/python2.7/site-packages/salt/utils/jinja.pyt<module>s~"	�#	!				

Zerion Mini Shell 1.0