403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /usr/lib/python3.11/site-packages/ansible/template/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.11/site-packages/ansible/template/__pycache__/__init__.cpython-311.pyc
�

���c�����ddlmZmZmZeZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
mZmZmZmZddlmZddlmZddlmZddlmZmZddlmZdd	lmZdd
lm Z m!Z!ddl"m#Z$ddl%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+dd
l,m-Z-m.Z.ddl/m0Z0m1Z1m2Z2ddl3m4Z4ddl5m6Z6m7Z7m8Z8ddl9m:Z:m;Z;m<Z<ddl=m>Z>ddl?m@Z@ddlAmBZBddlCmDZDddlEmFZFddlGmHZHeB��ZIddgZJeKefZLdZMeNd��ZOeNd��ZPeeQd����ZRd4d�ZSd�ZTd�ZUd �ZVd!�ZWd"�ZXd#�ZYd$�ZZd%�Z[d&�Z\Gd'�d(e!��Z]Gd)�d*e ��Z^Gd+�d,e��Z_d-�Z`eZd.���ZaGd/�d0e��ZbGd1�d2eb��ZcGd3�d��ZddS)5�)�absolute_import�division�print_functionN)�Iterator�Sequence�Mapping�MappingView�MutableMapping)�contextmanager)�Number)�
format_exc)�TemplateSyntaxError�UndefinedError)�FileSystemLoader)�NativeEnvironment)�Context�StrictUndefined)�	constants)�AnsibleAssertionError�AnsibleError�AnsibleFilterError�AnsibleLookupError�AnsibleOptionsError�AnsibleUndefinedVariable)�string_types�	text_type)�	to_native�to_text�to_bytes)�is_sequence)�
filter_loader�
lookup_loader�test_loader)�ansible_native_concat�ansible_eval_concat�ansible_concat)�AnsibleJ2Template)�
AnsibleJ2Vars)�Display)�listify_lookup_plugin_terms��NativeJinjaText)�wrap_var�Templar�generate_ansible_template_varsz#jinja2:)�variable_begin�block_begin�
comment_begin�	raw_begin)�variable_end�	block_end�comment_end�raw_endc
���|�t|��}nt|��}	tjtj|��j��j}n0#ttf$rtj|��j}YnwxYwttj
��d��|tj�tj
�|����t|��tj���|rt!|��ndd�}|�#tj
�|��|d<n||d<t$j}|�|d|d|d���}tt+jt!|��t+jtj
�|��������|d<|S)	N�)�
template_host�
template_path�template_mtime�template_uid�template_run_date�template_destpath�template_fullpathr:r=r;)�host�uid�file�ansible_managed)r�pwd�getpwuid�os�stat�st_uid�pw_name�KeyError�	TypeErrorr�uname�datetime�
fromtimestamp�path�getmtime�nowr�abspath�C�DEFAULT_MANAGED_STR�format�time�strftime�	localtime)rP�fullpath�	dest_path�b_pathr=�	temp_vars�managed_default�managed_strs        �>/usr/lib/python3.11/site-packages/ansible/template/__init__.pyr/r/Ls������$������(�#�#��.��|�B�G�F�O�O�$:�;�;�C�����i� �.�.�.��w�v���-����.����!�����A��/�/��"�+�9�9�"�'�:J�:J�6�:R�:R�S�S���-�-�%�.�2�2�4�4�5>�H�Y�y�1�1�1�D�
��I���)+�����)>�)>�	�%�&�&�)1�	�%�&��+�O�!�(�(�
��
'��n�%�
��
'�)���K�
$+�4�=��;�9O�9O�QU�Q_�`b�`g�`p�`p�qw�`x�`x�Qy�Qy�+z�+z�#{�#{�I�� ��s�0A�*B�Bc��d|vr�d|vr�g}|�|��}d}|�|��D]�}|ddkrd}|�|d���,|ddkrd}|�|d���V|r<|dd	kr0|�|d�dd
������|�|d����d�|��}|S)a�Double backslashes within jinja2 expressions

    A user may enter something like this in a playbook::

      debug:
        msg: "Test Case 1\3; {{ test1_name | regex_replace('^(.*)_name$', '\1')}}"

    The string inside of the {{ gets interpreted multiple times First by yaml.
    Then by python.  And finally by jinja2 as part of it's variable.  Because
    it is processed by both python and jinja2, the backslash escaped
    characters get unescaped twice.  This means that we'd normally have to use
    four backslashes to escape that.  This is painful for playbook authors as
    they have to remember different rules for inside vs outside of a jinja2
    expression (The backslashes outside of the "{{ }}" only get processed by
    yaml and python.  So they only need to be escaped once).  The following
    code fixes this by automatically performing the extra quoting of
    backslashes inside of a jinja2 expression.

    �\z{{Fr9r0T�r4�stringz\\�)�
preprocess�lex�append�replace�join)�data�	jinja_env�new_data�d2�in_var�tokens      r`�_escape_backslashesrqqs��(�t�|�|�������
�
!�
!�$�
'�
'�����]�]�2�&�&�	*�	*�E��Q�x�+�+�+�������a��)�)�)�)��q��^�+�+�������a��)�)�)�)��
*�E�!�H��0�0�����a�� 0� 0��v� >� >�?�?�?�?�����a��)�)�)�)��w�w�x� � ���K�c�l�t|t��r|j|j|jfD]	}||vrdS�
dS)a�Determines if a string looks like a template, by seeing if it
    contains a jinja2 start delimiter. Does not guarantee that the string
    is actually a template.

    This is different than ``is_template`` which is more strict.
    This method may return ``True`` on a string that is not templatable.

    Useful when guarding passing a string for templating, but when
    you want to allow the templating engine to make the final
    assessment which may result in ``TemplateSyntaxError``.
    TF)�
isinstancer�block_start_string�variable_start_string�comment_start_string)rkrl�markers   r`�is_possibly_templatery�sP���$��%�%�� �3�Y�5T�V_�Vt�u�	�	�F���~�~��t�t���5rrc��d}d}d}|�|��}t||��sdS	|�|��D]�}|dtvr4|r|ddkrd}d}|d�d��d}�E|dt
vr.|d�d��d|krdS|r�dS��n#t$rYdSwxYwdS)z�This function attempts to quickly detect whether a value is a jinja2
    template. To do so, we look for the first 2 matching jinja2 tokens for
    start and end delimiters.
    NTFr9r2�_r)rfryrg�JINJA2_BEGIN_TOKENS�split�JINJA2_END_TOKENSr)rkrl�found�start�commentrnrps       r`�is_templater��s)��

�E��E��G�	�	�	�d�	#�	#�B� ��I�.�.���u���]�]�2�&�&�
	�
	�E��Q�x�.�.�.��#�U�1�X��8�8�"�G����a����s�+�+�A�.����q��.�.�.���8�>�>�#�&�&�q�)�U�2�2��4�4�����u�u�/�
	�������u�u������5s�BC�C�C�
C�Cc��	t|��}|dz
}||dkr|dz}||dk�|dz
|z
S#t$r|cYSwxYw)z�
    Counts the number of newlines at the end of a string. This is used during
    the jinja2 templating to ensure the count matches the input, since some newlines
    may be thrown away during the templating.
    r9�
)�len�
IndexError)�in_str�i�js   r`�_count_newlines_from_endr��sv�����K�K��
��E���Q�i�4���
��F�A��Q�i�4����1�u�q�y��������������s�8;�A
�	A
c�.�ddlm}t|t��r|D]}t	||���dSt|t
��r|D]}t	|���dSt||��r"t
d�|�����dS)Nr��	Undefinedz{0} is undefined)�jinja2.runtimer�rtr
�recursive_check_defined�listrrV)�itemr��keyr�s    r`r�r��s���(�(�(�(�(�(��$��'�'�F��	/�	/�C�#�D��I�.�.�.�.�	/�	/�	�D�$�	�	�F��	'�	'�A�#�A�&�&�&�&�	'�	'��d�I�&�&�	F�$�%7�%>�%>�t�%D�%D�E�E�E�	F�	Frrc��t|t��p)t|t��pt|t��S)zfHelper method to determine if something is an unrolled generator,
    iterator, or similar object
    )rtrr	�
RANGE_TYPE)�values r`�
_is_rolledr��s:��
	�5�(�#�#�	&��5�+�&�&�	&��5�*�%�%�rrc�.���fd�}t|���S)z�Wrapper function, that intercepts the result of a templating
    and auto unrolls a generator, so that users are not required to
    explicitly use ``|list`` to unroll.
    c�T���|i|��}t|��rt|��S|S�N)r�r���args�kwargs�ret�funcs   �r`�wrapperz!_unroll_iterator.<locals>.wrappers6����d�D�#�F�#�#���c�?�?�	���9�9���
rr��_update_wrapper�r�r�s` r`�_unroll_iteratorr�s.���
������7�D�)�)�)rrc���dD]4}	t||��}t|||���%#t$rY�1wxYwdD]4}t||���t||i�����5||_|S)N)�
__module__�__name__�__qualname__�__doc__�__annotations__)�__dict__)�getattr�setattr�AttributeError�update�__wrapped__)r�r��attrr�s    r`r�r�s���Y�*�*��	*��D�$�'�'�E�
�G�T�5�)�)�)�)���	�	�	��D�	�����?�?�������%�%�g�d�D�"�&=�&=�>�>�>�>��G���Ns�(�
5�5c�.���fd�}t|���S)z�Wrapper function, that intercepts the result of a filter
    and wraps it into NativeJinjaText which is then used
    in ``ansible_native_concat`` to indicate that it is a text
    which should not be passed into ``literal_eval``.
    c�2���|i|��}t|��Sr�r+r�s   �r`r�z"_wrap_native_text.<locals>.wrapper$s%����d�D�#�F�#�#���s�#�#�#rrr�r�s` r`�_wrap_native_textr�s.���$�$�$�$�$��7�D�)�)�)rrc�*�eZdZdZd�Zd�Zd�Zd�ZdS)�AnsibleUndefinedz}
    A custom Undefined class, which returns further Undefined objects on access,
    rather than throwing an exception.
    c�0�|dkrt|���|S)N�
__UNSAFE__)r�)�self�names  r`�__getattr__zAnsibleUndefined.__getattr__0s"���<���!��&�&�&��rrc��|Sr���r�r�s  r`�__getitem__zAnsibleUndefined.__getitem__8����rrc�N�d�|j|j|j��S)Nz3AnsibleUndefined(hint={0!r}, obj={1!r}, name={2!r}))rV�_undefined_hint�_undefined_obj�_undefined_name�r�s r`�__repr__zAnsibleUndefined.__repr__<s,��D�K�K�� ���� �
�
�	
rrc��|Sr�r�)r�r�s  r`�__contains__zAnsibleUndefined.__contains__Cr�rrN)r�r�r�r�r�r�r�r�r�rrr`r�r�+sZ��������������
�
�
�����rrr�c�>��eZdZdZ�fd�Zd�Zd�Z�fd�Zd�Z�xZ	S)�AnsibleContexta$
    A custom context, which intercepts resolve_or_missing() calls and sets a flag
    internally if any variable lookup returns an AnsibleUnsafe value. This
    flag is checked post-templating, and (when set) will result in the
    final templated result being wrapped in AnsibleUnsafe.
    c�V��tt|��j|i|��d|_dS)NF)�superr��__init__�unsafe�r�r�r��	__class__s   �r`r�zAnsibleContext.__init__Os0���,��n�d�#�#�,�d�=�f�=�=�=�����rrc�,�t|t��r6|���D] }|�||��rdS�!nHt|t��r|D]}|�|��rdS�nt|dd��durdSdS)a
        Our helper function, which will also recursively check dict and
        list entries due to the fact that they may be repr'd and contain
        a key or value which contains jinja2 syntax and would otherwise
        lose the AnsibleUnsafe value.
        Tr�F)rt�dict�keys�
_is_unsafer�r�)r��valr�r�s    r`r�zAnsibleContext._is_unsafeSs����c�4� � �		��x�x�z�z�
 �
 ���?�?�3�s�8�,�,� ��4�4� �
 ���T�
"�
"�	��
 �
 ���?�?�4�(�(� ��4�4� �
 ��S�,��
.�
.�$�
6�
6��4��urrc�\�|�%|js |�|��r
d|_dSdSdSdS�NT)r�r�)r�r�s  r`�_update_unsafezAnsibleContext._update_unsafefs7���?�4�;�?�4�?�?�3�3G�3G�?��D�K�K�K��?�?�?�?�?rrc���tt|���|��}|�|��|Sr�)r�r��resolve_or_missingr�)r�r�r�r�s   �r`r�z!AnsibleContext.resolve_or_missingjs9����N�D�)�)�<�<�S�A�A�����C� � � ��
rrc���|js|jS|js|jSt|jt��r|j�|j��St|jfi|j��S)a�Return the complete context as a dict including the exported
        variables. For optimizations reasons this might not return an
        actual copy so be careful with using it.

        This is to prevent from running ``AnsibleJ2Vars`` through dict():

            ``dict(self.parent, **self.vars)``

        In Ansible this means that ALL variables would be templated in the
        process of re-creating the parent because ``AnsibleJ2Vars`` templates
        each variable in its ``__getitem__`` method. Instead we re-create the
        parent via ``AnsibleJ2Vars.add_locals`` that creates a new
        ``AnsibleJ2Vars`` copy without templating each variable.

        This will prevent unnecessarily templating unused variables in cases
        like setting a local variable and passing it to {% include %}
        in a template.

        Also see ``AnsibleJ2Template``and
        https://github.com/pallets/jinja/commit/d67f0fd4cc2a4af08f51f4466150d49da7798729
        )�vars�parentrtr(�
add_localsr�r�s r`�get_allzAnsibleContext.get_allosp��,�y�	��;���{�	��9���d�k�=�1�1�	2��;�)�)�$�)�4�4�4����1�1�t�y�1�1�1rr)
r�r�r�r�r�r�r�r�r��
__classcell__�r�s@r`r�r�Hs������������������&��������
2�2�2�2�2�2�2rrr�c�@��eZdZdZ�fd�Zd�Zd�Zd�Zd�Zd�Z	�xZ
S)�JinjaPluginInterceptz� Simulated dict class that loads Jinja2Plugins at request
        otherwise all plugins would need to be loaded a priori.

        NOTE: plugin_loader still loads all 'builtin/legacy' at
        start so only collection plugins are really at request.
    c���tt|��j|i|��||_||_t��|_dSr�)r�r�r��
_pluginloader�
_delegatee�set�_loaded_builtins)r��	delegatee�pluginloaderr�r�r�s     �r`r�zJinjaPluginIntercept.__init__�sK���2��"�D�)�)�2�D�C�F�C�C�C�)���$���!$������rrc	���t|t��stdt|��z���d}||jvr�d}	|j�|��}n\#ttf$r}|}Yd}~nDd}~wt$r4}t�d|�dt|������|�d}~wwxYw|r)|j
|j|<|j�|��	|j|}n7#t$r*}t!d|�dt|p|����d���d}~wwxYw|jjdkr-|t"jvrt'|��}nt)|��}|S)Nz$key must be a string, got %s insteadzUnexpected plugin load (z
) exception: zCould not load "z": r�filter)rtr�
ValueError�typer�r��getrrK�	Exception�display�vvvvr�j2_functionr��addrrT�STRING_TYPE_FILTERSr�r�)r�r��original_exc�plugin�er�s      r`r�z JinjaPluginIntercept.__getitem__�s����#�|�,�,�	Q��C�d�3�i�i�O�P�P�P����d�+�+�+��F�
��+�/�/��4�4���� �(�+�
!�
!�
!� ������������
�
�
�����C�C�C�QZ�[\�Q]�Q]�Q]�^�_�_�_�������
����
�
/�'-�'9����$��%�)�)�#�.�.�.�	j��?�3�'�D�D���	j�	j�	j�%�%�3�3�3�	�R^�Rc�bc�Hd�Hd�Hd�&e�gh�i�i�i�����	j������"�h�.�.��a�+�+�+�(��.�.���(��-�-���s<�A�B7�/A6�6
B7�/B2�2B7�&
C4�4
D(�>%D#�#D(c�8�|j�||��Sr�)r��__setitem__)r�r�r�s   r`r�z JinjaPluginIntercept.__setitem__�s����*�*�3��6�6�6rrc��t���r�)�NotImplementedErrorr�s  r`�__delitem__z JinjaPluginIntercept.__delitem__�s��!�#�#�#rrc�*�t|j��Sr�)�iterr�r�s r`�__iter__zJinjaPluginIntercept.__iter__�s���D�O�$�$�$rrc�*�t|j��Sr�)r�r�r�s r`�__len__zJinjaPluginIntercept.__len__�s���4�?�#�#�#rr)r�r�r�r�r�r�r�r�r�rr�r�s@r`r�r��s����������
&�
&�
&�
&�
&�&�&�&�P7�7�7�$�$�$�%�%�%�$�$�$�$�$�$�$rrr�c��t|t��r'|���D]}t|���nHt	|��r|D]}t|���n$t|t
��rt
|��|S)zsRecursively find an undefined value in a nested data structure
    and properly raise the undefined exception.
    )rtr�values�_fail_on_undefinedr r�str)rkr�r�s   r`rr�s����$�� � ���[�[�]�]�	&�	&�E��u�%�%�%�%�	&�	�T�	�	���	%�	%�D��t�$�$�$�$�	%��d�O�,�,�	�
��I�I�I��Krrc�(�t|���|ndS)aSA custom finalize function for jinja2, which prevents None from being
    returned. This avoids a string of ``"None"`` as ``None`` has no
    importance in YAML.

    The function is decorated with ``_unroll_iterator`` so that users are not
    required to explicitly use ``|list`` to unroll a generator. This only
    affects the scenario where the final result of templating
    is a generator, e.g. ``range``, ``dict.items()`` and so on. Filters
    which can produce a generator in the middle of a template are already
    wrapped with ``_unroll_generator`` in ``JinjaPluginIntercept``.
    Nre)r)�things r`�_ansible_finalizer�s��'�u�-�-�9�5�5�r�Arrc�@��eZdZdZeZeZee	��Z
�fd�Z�xZS)�AnsibleEnvironmentz�
    Our custom environment, which simply allows us to override the class-level
    values for the Template and Context classes used by jinja2 internally.
    c����t��j|i|��t|jt��|_t|jt��|_d|_t|_	t|_dSr�)r�r�r��filtersr!�testsr#�trim_blocksr��	undefinedr�finalizer�s   �r`r�zAnsibleEnvironment.__init__s_��������$�)�&�)�)�)�+�D�L�-�H�H���)�$�*�k�B�B��
����)���)��
�
�
rr)
r�r�r�r�r��
context_classr'�template_class�staticmethodr%�concatr�r�r�s@r`r
r
s^���������#�M�&�N�
�\�-�
.�
.�F�	*�	*�	*�	*�	*�	*�	*�	*�	*rrr
c�4��eZdZee��Z�fd�Z�xZS)�AnsibleNativeEnvironmentc�l��t��j|i|��tt��|_dSr�)r�r�r�rrr�s   �r`r�z!AnsibleNativeEnvironment.__init__s3��������$�)�&�)�)�)�(�);�<�<��
�
�
rr)r�r�r�rr$rr�r�r�s@r`rrsH�������
�\�/�
0�
0�F�=�=�=�=�=�=�=�=�=rrrc���eZdZdZdd�Zefd�Zd�Zed���Z	e	j
d���Z	ed���Z		dd�Z
d�ZeZd
�Zd�Zd�Zdd�Zd�Zd�Zdd�Z		dd�ZeZdS)r.zQ
    The main class for templating, with the main entry-point of template().
    Nc���|�t�dd���||_|�in||_tj|_tjrtnt}||�
��t|r|���nd�����|_
||j
j_t |j
jd<|j|j
jd<|jx|j
jd<|j
jd	<|j|j
jd
<|j|j
jd<d|_t/jd|j
j�d
|j
j�d���|_tj|_dS)NzuThe `shared_loader_obj` option to `Templar` is no longer functional, ansible.plugins.loader is used directly instead.z2.16��version�.)�
extensions�loaderr��lookup�query�qrR�undef�^z\s*(\w*)\s*�$)r��
deprecated�_loader�_available_variablesrT�DEFAULT_UNDEFINED_VAR_BEHAVIOR�_fail_on_undefined_errors�DEFAULT_JINJA2_NATIVErr
�_get_extensionsr�get_basedir�environmentr�environment_classr��globals�_lookup�
_query_lookup�
_now_datetime�_make_undefined�cur_context�re�compilerv�variable_end_string�
SINGLE_VAR�
jinja2_native)r�r�shared_loader_obj�	variablesr.s     r`r�zTemplar.__init__$s����(����C��
�
�
�
����*3�*;�B�B���!�)*�)I��&�89�8O�g�4�4�Ug��,�,��+�+�-�-�#�F�$K�F�$6�$6�$8�$8�$8��L�L�
�
�
���=N���'�9�,0��� ��(�.2�\��� ��*�LP�L^�^��� ��)�D�,<�,D�S�,I�*.�*<��� ��'�,0�,@��� ��)� ����*�*�T�=M�=c�=c�=c�ei�eu�fJ�fJ�fJ�&K�L�L����4����rrc���t�|��}|j�|jj��t�t
��}|j�|j��||_|tu|_||jd�}|�	��D]?\}}|�
||��}	|�t|||���0#t$rY�<wxYw|S)aVCreates a new copy of Templar with a new environment.

        :kwarg environment_class: Environment class used for creating a new environment.
        :kwarg \*\*kwargs: Optional arguments for the new environment that override existing
            environment attributes.

        :returns: Copy of Templar with updated environment.
        ��available_variables�
searchpath)
�object�__new__r�r�r-r.rr9r�itemsr�r�r�)	r�r.r��new_env�new_templar�mappingr�r��objs	         r`�copy_with_new_envzTemplar.copy_with_new_envJs����.�.�!2�3�3������� 0� 9�:�:�:��n�n�W�-�-����#�#�D�M�2�2�2�")���$5�9Q�$Q��!�$/�!�.�
�
��
!�,�,�.�.�	�	�J�C���+�+�c�7�+�+�C�
��$��C��e�,�,�,���!�
�
�
���
�����s�C � 
C-�,C-c��g}tjr3tj�dd���d��}|S)z�
        Return jinja2 extensions to load.

        If some extensions are set via jinja_extensions in ansible.cfg, we try
        to load them with the jinja environment.
        � re�,)rT�DEFAULT_JINJA2_EXTENSIONSrir})r��
jinja_extss  r`r+zTemplar._get_extensionsnsC���
��&�	Q��4�<�<�S�"�E�E�K�K�C�P�P�J��rrc��|jSr�)r'r�s r`r>zTemplar.available_variables~s���(�(rrc�|�t|t��stdt|��z���||_dS)a

        Sets the list of template variables this Templar instance will use
        to template things, so we don't have to pass them around between
        internal methods. We also clear the template cache here, as the variables
        are being changed.
        z8the type of 'variables' should be a Mapping but was a %sN)rtrrr�r')r�r;s  r`r>zTemplar.available_variables�sC���)�W�-�-�	x�'�(b�fj�kt�fu�fu�(v�w�w�w�$-��!�!�!rrc+�zK�||jjd�}i}|���D]W\}}|�||j��}	t	||��||<|�t|||���H#t$rY�TwxYwdV�|D]4}|�||j��}t||||���5dS)a;Context manager used to set temporary templating context, without having to worry about resetting
        original values afterward

        Use a keyword that maps to the attr you are setting. Applies to ``self.environment`` by default, to
        set context on another object, it must be in ``mapping``.
        r=N)r-rrBr�r�r�r�)r�r�rE�originalr�r�rFs       r`�set_temporary_contextzTemplar.set_temporary_context�s�����$(��*�1�
�
���� �,�,�.�.�	�	�J�C���+�+�c�4�#3�4�4�C�
� '��S� 1� 1���
��$��C��e�,�,�,���!�
�
�
���
����	�����	-�	-�C��+�+�c�4�#3�4�4�C��C��h�s�m�,�,�,�,�	-�	-s�	&A0�0
A=�<A=FTc	�0�����
�|�gn|}|	�t�dd���t|d��r|S���j�|r��|��}t|t��r���|��s|S�j�	|��}|rP|�
d��}|�jvr2�j|}
t|
t��r|
S|
�tjS��|�|���
|���}|St!|��r�
����fd�|D��St|t"��rNi}|���D]5}||vr$��||����
�	��||<�*||||<�6|S|S)
z�
        Templates (possibly recursively) any given data as input. If convert_bare is
        set to True, the given data will be wrapped as a jinja2 variable ('{{foo}}')
        before being sent through the template engine.
        NzjThe `cache` option to `Templar.template` is no longer functional, and will be removed in a future release.�2.18rr�r9)�preserve_trailing_newlines�escape_backslashes�fail_on_undefined�	overrides�disable_lookups�convert_datac	�D��g|]}��|���������S)�rTrVrWrX)�template)�.0�vrXrVrWrTr�s  �����r`�
<listcomp>z$Templar.template.<locals>.<listcomp>�sM���!�!�!��
�M�M��+E�"3�#� /�"���!�!�!rrr[)r�r%�hasattrr)�_convert_bare_variablertrryr8�match�groupr'�NON_TEMPLATED_TYPESrT�DEFAULT_NULL_REPRESENTATION�do_templater rr�r\)r��variable�convert_barerTrUrVrWrY�static_vars�cacherX�only_one�var_name�resolved_val�result�d�ks`  ` ``   `      r`r\zTemplar.template�s;�������(�/�b�b�[������� L�V\��
]�
]�
]��8�\�*�*�	��O��$� $� >���	=��2�2�8�<�<�H��h��-�-�6	��,�,�X�6�6�
 ���
��,�,�X�6�6�H��
=�#�>�>�!�,�,���t�8�8�8�#'�#<�X�#F�L�!�,�0C�D�D�=�+�+�%�-� �<�<��%�%��+E�#5�"3�#� /�)�&���F��M�
��
"�
"�	�!�!�!�!�!�!�!�!� �
!�!�!�
!���'�
*�
*�	��A��]�]�_�_�

'�

'���K�'�'��=�=� ���3M�*;�"+�(7�)���A�a�D�D�$�A�;�A�a�D�D��H��Orrc�h�t|t��rt||j��St|tt
f��r|D]}|�|��rdS�nMt|t��r8|D]5}|�|��s|�||��rdS�6dS)z#lets us know if data has a templateTF)rtrr�r-r��tupler�)r�rkr^rps    r`r�zTemplar.is_template�s����d�L�)�)�		 ��t�T�%5�6�6�6�
��t�U�m�
,�
,�	 ��
 �
 ���#�#�A�&�&� ��4�4� �
 ���d�
#�
#�	 ��
 �
 ���#�#�A�&�&� �$�*:�*:�4��7�*C�*C� ��4�4� ��urrc�,�t||j��Sr�)ryr-)r�rks  r`ryzTemplar.is_possibly_templates��#�D�$�*:�;�;�;rrc�<�t|t��r�d|v}|�d��d�d��d�d��d}|s	||jvr*|jj|vr|jj�|�|jj��S|S)z�
        Wraps a bare string, which may have an attribute portion (ie. foo.bar)
        in jinja2 variable braces so that it is evaluated properly.
        �|rr�[)rtrr}r'r-rvr7)r�rg�contains_filters�
first_parts    r`razTemplar._convert_bare_variables����h��-�-�	{�"�h���!����,�,�Q�/�5�5�c�:�:�1�=�C�C�C�H�H��K�J� �
{�J�$�2K�$K�$K�QU�Qa�Qw�@H�RH�RH�#'�#3�#I�#I�8�8�UY�Ue�Uy�Uy�z�z��rrc�&�td|z���)NzHThe lookup `%s` was found, however lookups were disabled from templating)r�r�r�r�r�s    r`�_fail_lookupzTemplar._fail_lookups���e�hl�l�m�m�mrrc��|rtj���}ntj���}|r|�|��S|S)zUjinja2 global function to return current datetime, potentially formatted via strftime)rN�utcnowrRrX)r��utc�fmtrRs    r`r2zTemplar._now_datetime!sS���	*��#�*�*�,�,�C�C��#�'�'�)�)�C��	%��<�<��$�$�$��
rrc�.�d|d<|j|g|�Ri|��S)z( wrapper for lookup, force wantlist trueT�wantlist)r0rzs    r`r1zTemplar._query_lookup-s.��!��z���t�|�D�2�4�2�2�2�6�2�2�2rrc	�D�tj||j|���}|�td|z���|�dd��}|�dt
j��}|�dd��}t||dd�	��}	|j|fd
|j	i|��}	�n#ttf$r}
t|
���d}
~
wt$r}
|
�d}
~
wt$rh}
dt|
��z}|dkrt�|��n%|d
krt�|d���n|
�|rgndcYd}
~
Sd}
~
wt"$r�}
d|�dt%|
���dt'|
����}|dkrt�|��nz|d
krt�|d���nWt�d�t-������tt|��|
����|rgndcYd}
~
Sd}
~
wwxYwt/|	��s3t�d|�dt%|	���d|�d�d���|	�r4|du�r/|jrd|j_|rt7|	��S	t9|	dt:��r0t7t;d�|	������}	n"t7d�|	����}	n�#t>$rbt9|	t@��std|z���tC|	��dkrt7|	d��}	nt7|	��}	Yn1tD$r%t7d�|	����}	YnwxYw|	S)N)r�templarzlookup plugin (%s) not foundr�F�allow_unsafe�errors�strictT)�termsr�rVrhr;z0Lookup failed but the error is being ignored: %s�warn�ignore)�log_onlyzAAn unhandled exception occurred while running the lookup plugin 'z'. Error was a z, original message: z&exception during Jinja2 execution: {0}��orig_exczThe lookup plugin 'z&' was expected to return a list, got 'z' instead. The lookup plugin 'zM' needs to be changed to return a list. This will be an error in Ansible 2.18rSrrrJz-The lookup plugin '%s' did not return a list.r9)#r"r�r&r�poprT�DEFAULT_ALLOW_UNSAFE_LOOKUPSr*�runr'rrrrrr��warningr�r�r�vvvrVr
r r%r4r�r-rtr,rjrLrr�rK)r�r�r�r��instancer�r�r��
loop_terms�ranr��msgs            r`r0zTemplar._lookup2s �� �$�T�$�,��M�M�M�����=��D�E�E�E��:�:�j�%�0�0���z�z�.�!�2P�Q�Q�����H�h�/�/��0�t�T�]a�pu�v�v�v�
�	,��(�,�z�Y�Y�T�5N�Y�RX�Y�Y�C�C��(�.�9�	.�	.�	.�*�1�-�-�-�����"�	�	�	��G�����!�		,�		,�		,�D�y�QR�|�|�S�C���������$�$�$�$��8�#�#�����d��3�3�3�3���!�+�2�2�t�+�+�+�+�+�+������	,�	,�	,�	,��4�4��a�����'�!�*�*�*�.�C���������$�$�$�$��8�#�#�����d��3�3�3�3����D�K�K�J�L�L�Y�Y�Z�Z�Z�"�9�S�>�>�A�>�>�>�>�!�+�2�2�t�+�+�+�+�+�+�����	,�����3���	����8�t�8�8�UY�Z]�U^�U^�8�8�'+�8�8�8��	
�
�
�
��	.�<�5�(�(���
/�*.�� �'��
%���}�}�$�
.��c�!�f�o�6�6�2�"�?�3�8�8�C�=�=�#A�#A�B�B�C�C�"�3�8�8�C�=�=�1�1�C����
(�
(�
(�"�#�x�0�0�/�&�'V�)-�(.�/�/�/�
�s�8�8�q�=�=�"�3�q�6�*�*�C�C�"�3�-�-�C����
.�
.�
.�
�s�x�x��}�}�-�-����
.�����
sd�B(�(H$�9C�
H$�C�
H$�$AE�H$�
H$�CH�H$�H$�A-L�A)N�/+N�Nc�`�ddlm}|�t||��s|dkrd}t|��S)Nrr�rez*Mandatory variable has not been overridden)r�r�rtr�)r��hintr�s   r`r3zTemplar._make_undefined�sB��,�,�,�,�,�,��<�:�d�I�6�6�<�$�"�*�*�?�D���%�%�%rrc	� 	�|jrt|t��s|St|��}|�|j}|�t��}		|r|j�|��}
n#|	r|j���}
n|j}
|	r�|�	d��}|tt��|�}||dzd�}|�d��D]�}
d|
vr$td|
�
��z���|
�dd��\}}|�
��}t|
|tj|�
��������|rt#||
��}	|
�|��}n�#t&$r6}tdt)|���dt)|����|����d}~wt*$r>}d	t)|��vr!td
t)|��z|����|cYd}~Sd}~wwxYw|r#|jx|jd<x|jd<|jd
<t1||j��}|j}|jjj|j_|js|st8|j_|�|d���|_|�|j��}	|j�|��}t?|jdd��}|rtA|��}n�#tB$r�}dt)|��vr8dt)|��z}|dt)|��zz
}tE||����tF�$dtK|��z��tdt)|���dt)|����|����d}~wwxYw||_n#||_wxYwt|t��r=|r;t|��}||kr&||jj&||z
zz
}|rtA|��}|S#tNtDf$rI}|rtE||����tF�$dtK|��z��|cYd}~Sd}~wwxYw)Nr�r9rJ�:zhfailed to parse jinja2 override '%s'. Did you use something different from colon as key-value separator?z(template error while templating string: z
. String: r��	recursionz.recursive loop detected in template string: %sr r!rT)�sharedr�Fr�zIUnable to look up a name or access an attribute in template string (%s).
zMMake sure your variable name does not contain invalid characters like '-': %sz5failing because of a type error, template data is: %sz.Unexpected templating type error occurred on (z): zIgnoring undefined failure: %s)(r9rtrr�r)�
startswith�JINJA2_OVERRIDEr-�overlay�findr�r}r�stripr��ast�literal_evalrq�from_stringrrr�r{r/r(r4r�rr&�new_context�root_render_funcr�r-rLrr��debugr�newline_sequencer)r�rkrTrUrVrWrXrY�
data_newlines�has_template_overrides�myenv�eol�line�pairr�r��tr��jvars�cached_context�rf�resr��te�errmsg�res_newliness                          r`rfzTemplar.do_template�sM����	�j��|�&D�&D�	��K�1��6�6�
��$� $� >��!%����!A�!A��e	��
)��(�0�0��;�;���'�
)��(�0�0�2�2����(��&�

G��i�i��o�o���C��0�0��4�5���C�!�G�H�H�~�� �J�J�s�O�O�G�G�D��$���*�,q�sw�s}�s}�s�s�,@�A�A�A�!%���C��!3�!3�J�S�#��)�)�+�+�C��E�3��(8������(E�(E�F�F�F�F�!�
8�*�4��7�7��
 ��%�%�d�+�+����&�
K�
K�
K�"�l�_h�ij�_k�_k�_k�_k�mv�w{�m|�m|�m|�#}�IJ�K�K�K�K������
 �
 �
 ��)�A�,�,�.�.�&�'W�Zc�dh�Zi�Zi�'i�tu�v�v�v�v��K�K�K�K�K�K�����	
 �����
^�LP�L]�]��	�'�"�]�Q�Y�s�^�a�i��6I�!�$��	�2�2�E�"�-�N�
'+�&6�&@�&G�D��#��%�
9�l�
9�*8�� �'� �}�}�U�4�}�@�@�D���#�#�D�$4�5�5�B�
2��&�-�-�b�1�1�� ��!1�8�U�C�C���(�"�3�-�-�C����
P�
P�
P�%��2���6�6�i�lu�vz�l{�l{�{�F��m�py�z|�p}�p}�}�}�F�2�6�B�G�G�G�G��M�M�"Y�\c�dh�\i�\i�"i�j�j�j�&�,�bk�lp�bq�bq�bq�bq�s|�}�tA�tA�tA�(B�MO�P�P�P�P�����
P����$2�� � ��>�� �1�1�1�1��#�|�,�,�
,�1K�
,� 8��<�<�� �<�/�/��4�+�<�
�P\�@\�]�]�C��,�&�s�m�m���J��� 8�9�	�	�	� �
�.�q�1�=�=�=�=��
�
�>�����K�L�L�L������������	���s��D4P3�F�P3�
H#�'1G�
H#�%3H�H#�P3�H#�#B/P3�AL�O�
O�B$O�O�O�P3�	O�AP3�3R
�>R�R
�R
�NN)	FTTNNTNNF)FNr�)TTNNFF)r�r�r�r�r�r
rGr+�propertyr>�setterrrQr\r��templatableryrar{r2r1r0r3rf�_do_templater�rrr`r.r.s���������$5�$5�$5�$5�L3E�"�"�"�"�H��� �)�)��X�)���
.�
.� ��
.��-�-��^�-�:RV�RW�L�L�L�L�\����K�<�<�<���� n�n�n�
�
�
�
�3�3�3�
R�R�R�h&�&�&�&�SX�!&�s�s�s�s�l�L�L�Lrrr�)e�
__future__rrrr��
__metaclass__r�rNrGrEr5rW�collections.abcrrrr	r
�
contextlibr�numbersr�	tracebackr
�jinja2.exceptionsrr�jinja2.loadersr�jinja2.nativetypesrr�rr�ansiblerrT�ansible.errorsrrrrrr�ansible.module_utils.sixrr�ansible.module_utils._textrrr�'ansible.module_utils.common.collectionsr �ansible.plugins.loaderr!r"r#�ansible.template.native_helpersr$r%r&�ansible.template.templater'�ansible.template.varsr(�ansible.utils.displayr)�ansible.utils.listifyr*�ansible.utils.native_jinjar,�ansible.utils.unsafe_proxyr-r��__all__�boolrdr��	frozensetr|r~�ranger�r/rqryr�r�r�r�r�r�r�r�r�r�rrr
rr.r�rrr`�<module>r�s���&C�B�B�B�B�B�B�B�B�B��
�
�
�
�
�����	�	�	�	�
�
�
�
�	�	�	�	�����T�T�T�T�T�T�T�T�T�T�T�T�T�T�%�%�%�%�%�%������� � � � � � �A�A�A�A�A�A�A�A�+�+�+�+�+�+�0�0�0�0�0�0�3�3�3�3�3�3�3�3�"�"�"�"�"�"�����������������=�<�<�<�<�<�<�<�C�C�C�C�C�C�C�C�C�C�?�?�?�?�?�?�L�L�L�L�L�L�L�L�L�L�f�f�f�f�f�f�f�f�f�f�7�7�7�7�7�7�/�/�/�/�/�/�)�)�)�)�)�)�=�=�=�=�=�=�6�6�6�6�6�6�/�/�/�/�/�/�
�'�)�)���6�
7���V�n�����i� _�`�`���I�U�V�V��
�T�%�%��(�(�^�^�
�"�"�"�"�J(�(�(�V���&#�#�#�L���$F�F�F����*�*�*�
�
�
� 
*�
*�
*����������:F2�F2�F2�F2�F2�W�F2�F2�F2�RH$�H$�H$�H$�H$�>�H$�H$�H$�V���,�B�B���B�*�*�*�*�*�*�*�*�*�*=�=�=�=�=�1�=�=�=�d�d�d�d�d�d�d�d�d�drr

Youez - 2016 - github.com/yon3zu
LinuXploit