HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/1784574/root/usr/lib/python3/dist-packages/cloudinit/__pycache__/
Upload File :
Current File : //proc/1784574/root/usr/lib/python3/dist-packages/cloudinit/__pycache__/templater.cpython-311.pyc
�

܍~cM��f�UddlZddlZddlZddlmZddlmZddlmZ	ddlm
Z
ddlmZee
d<	ddlmZdd	lmZd
ZeZn#eef$rdZeZYnwxYweje��Zejdej��Zejd
��ZdZGd�de��Z d�Z!d�Z"d�Z#dd�Z$dd�Z%d�Z&d�Z'dS)�N)�Type)�log)�
type_utils)�util)�
write_file�
JUndefined)�DebugUndefined)�TemplateTFz##\s*template:(.*)z)\$\{([A-Za-z0-9_.]+)\}|\$([A-Za-z0-9_.]+)zCI_MISSING_JINJA_VAR/c��eZdZdZd�Zd�ZdS)�UndefinedJinjaVariablez>Class used to represent any undefined jinja template variable.c�"�t�|j��S)N)�MISSING_JINJA_PREFIX�_undefined_name)�selfs �5/usr/lib/python3/dist-packages/cloudinit/templater.py�__str__zUndefinedJinjaVariable.__str__/s��-�-�t�/C�/C�D�D�c��t|���td��}td�|j|������)N�zhUndefined jinja variable: "{this}-{other}". Jinja tried subtraction. Perhaps you meant "{this}_{other}"?)�this�other)�str�replacer�	TypeError�formatr)rrs  r�__sub__zUndefinedJinjaVariable.__sub__2sV���E�
�
�"�"�#7��<�<���
@�@F���)��AG�A�A�
�
�	
rN)�__name__�
__module__�__qualname__�__doc__rr�rrrr,s;������H�H�E�E�E�
�
�
�
�
rrc�D���fd�}t�||��S)z�This does simple replacement of bash variable like templates.

    It identifies patterns like ${a} or $a and can also identify patterns like
    ${a.b} or $a.b which will look for a key 'b' in the dictionary rooted
    by key 'a'.
    c
���|�d��}|�|�d��}|�td���tj|�d����}�}t|��dkro|���}t|t��s+td|�dtj|���d|�d����||}t|��dk�o|���}t|t��s*td	|�d
|�dtj|�������t||��S)N��z,Match encountered but no valid group present�.z&Can not traverse into non-dictionary 'z
' of type z while looking for subkey '�'zCan not extract key 'z' from non-dictionary ')
�group�RuntimeError�collections�deque�split�len�popleft�
isinstance�dictr�tu�obj_namer)�match�name�path�selected_params�key�paramss     �r�replacerzbasic_render.<locals>.replacerDsK����{�{�1�~�~���<��;�;�q�>�>�D��<��M�N�N�N�� ����C���1�1�� ���$�i�i�!�m�m��,�,�.�.�C��o�t�4�4�
��i�'�����O�(D�(D�(D�(D�c�c�c�K����.�c�2�O��$�i�i�!�m�m��l�l�n�n���/�4�0�0�	��)��3�3������_�)E�)E�)E�G���
��?�3�'�(�(�(r)�
BASIC_MATCHER�sub)�contentr8r9s ` r�basic_renderr=<s4���)�)�)�)�)�6���X�w�/�/�/rc��d�}|�d��dkr|�dd��\}}n|}d}t�|��}|s
dt|fS|�d��������}|dvrtd|z���|d	kr+ts$t�d
��dt|fS|d	krtrd	||fSdt|fS)Nc��|�d��rdnd}t|tddg���jdi|��|zS)N�
rTz
jinja2.ext.do)�	undefined�trim_blocks�
extensionsr!)�endswith�	JTemplater�render)r<r8�adds   r�jinja_renderz%detect_template.<locals>.jinja_rendercsp���&�&�t�,�,�4�d�d�"��
�I��0� �+�,�	
�
�
�
�
�
�
�
�
��

�	
rr@���r$r�basic)�jinjarJz.Unknown template rendering type '%s' requestedrKzcJinja not available as the selected renderer for desired template, reverting to the basic renderer.)�findr,�TYPE_MATCHERr3r=r(�lower�strip�
ValueError�JINJA_AVAILABLE�LOG�warning)�textrH�ident�rest�
type_match�
template_types      r�detect_templaterYbs.��
�
�
��y�y����"����j�j��q�)�)���t�t������#�#�E�*�*�J��-���t�,�,�"�(�(��+�+�1�1�3�3�9�9�;�;�
�� 2�2�2��@�� ���
��G�#�#�O�#��K�K�F�
�
�
��\�4�0�0�
�g�
%�
%�/�
%��\�4�0�0���t�,�,rc��|si}ttj|����\}}}t�d||��|||��S)Nz+Rendering content of '%s' using renderer %s)rYr�	load_filerR�debug)�fnr8rX�rendererr<s     r�render_from_filer_�sV������'6�t�~�b�7I�7I�'J�'J�$�M�8�W��I�I�;�R��O�O�O��8�G�V�$�$�$r�c�T�t||��}tj|||���dS)N��mode)r_rr)r]�outfnr8rc�contentss     r�render_to_filerf�s.����F�+�+�H��O�E�8�$�/�/�/�/�/�/rc�T�t||��}tj|||���dS)�
Render stringrbN)�
render_stringrr)r<rdr8rcres     r�render_string_to_filerj�s.���W�f�-�-�H��O�E�8�$�/�/�/�/�/�/rc�H�|si}t|��\}}}|||��S)rh)rY)r<r8�_template_typer^s    rriri�s5������(7��(@�(@�%�N�H�g��8�G�V�$�$�$rc�j�t|d��5}|���}ddd��n#1swxYwYd|i}t||�����dz}t	j|��|dkr!tj�|��dSt||d���dS)N�r�variantr@�-�w)�omode)
�open�readri�rstripr�	load_yaml�sys�stdout�writer)ro�template�output�fhre�
tpl_paramss      r�render_cloudcfgr~�s���	
�h��	�	����7�7�9�9���������������������W�%�J��h�
�3�3�;�;�=�=��D�H��N�8����
��}�}��
����"�"�"�"�"��6�8�3�/�/�/�/�/�/s�2�6�6)r`)(r*�rerw�typingr�	cloudinitr�loggingrr1r�cloudinit.atomic_helperr�__annotations__�jinja2r	�_DebugUndefinedr
rErQr�ImportError�AttributeError�object�	getLoggerrrR�compile�IrMr:rrr=rYr_rfrjrir~r!rr�<module>r�s��������	�	�	�	�
�
�
�
�������$�$�$�$�$�$�&�&�&�&�&�&�������.�.�.�.�.�.������8�8�8�8�8�8�,�,�,�,�,�,��O� �J�J���^�$�����O��J�J�J������g���!�!���r�z�/���6�6����
�G�H�H�
�.��


�

�

�

�

�Z�

�

�

� #0�#0�#0�L&-�&-�&-�R%�%�%�0�0�0�0�
0�0�0�0�%�%�%�
0�
0�
0�
0�
0s�A�A�A