HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/__pycache__/template.cpython-310.pyc
o

�N�g��@s�dZddlZddlZddlZddlZddlZddlZddlZddl	Zddl
ZddlZe�e
�ZdZe�e�Z				ddd�Zdd	�Zd
d�ZiZdD]Ze�d
�\ZZe�de��ee<qKdd�ZdS)z 
Manage basic template commands
�Nzutf-8�base�c	Ks�i}
t�d|�d|	vr|	�d�|dkrmt|t�s"t�d|�|
Stj�|�s0t�d|�|
St	j
j�|�r?t�d|�|
St
j|td��}|��}|��s^t�d|�|
Wd	�SWd	�n1shwYt||||||�}d
|v}
t�|�}|D]�\}}t	j
j�|�r�|�d�t||d�}|r�||d
<|�|	�|r�||d<t��}||||fi|��}
t�d||j�d�dt��|�|
d	ur�t�d�||||fi|��}
|
}t�t j!��rt	j
j�|
��rt�d|t	j
j"�#t	j
j$�%|
���|	�&d���|
�d�q�|
�rFt	j
j�|
��rd}|
��}nd}|
}t|t��rFd
|v�r>|�'dd
�}|�r:t�|�}
|
S|}
|
S|�rF|
�d�|
S)aD
    Take the path to a template and return the high data structure
    derived from the template.

    Helpers:

    :param mask_value:
        Mask value for debugging purposes (prevent sensitive information etc)
        example: "mask_value="pass*". All "passwd", "password", "pass" will
        be masked (as text).
    zcompile template: %s�env�:string:z&Template was specified incorrectly: %szTemplate does not exist: %szTemplate is an empty file: %s)�encodingz&Template is nothing but whitespace: %sNz
r)�	renderersZtmplpath�context�arglinez8Time (in seconds) to render '%s' using '%s' renderer: %s�.���g{�G�z�?zRendered data from file: %s:
%sZ
mask_valueTF�
)(�log�debug�pop�
isinstance�str�error�os�path�isfile�salt�utils�filesZis_empty�codecs�open�SLS_ENCODING�read�strip�template_shebang�io�StringIOZstringioZis_readable�seek�dict�update�timeZprofile�
__module__�split�sleep�isEnabledFor�loggingZGARBAGEZ
sanitizersZmask_args_value�data�decode�get�replace)�templater�default�	blacklist�	whitelistZsaltenvZsls�
input_datar�kwargs�ret�ifileZrender_pipeZwindows_newlineZrenderr	Z
render_kwargs�startZis_stringio�contents�r8�A/opt/saltstack/salt/lib/python3.10/site-packages/salt/template.py�compile_templates�

��	�



�
��
�

��
r:cCsltjj��}tjj�|d��}|�t|�d�Wd�n1s"wYt|||||�}t�	|�|S)ze
    Take template as a string and return the high data structure
    derived from the template.
    �wbrN)
rrrZmkstemp�fopen�write�SLS_ENCODERr:r�unlink)r.rr/r0r1Zfn_Zofiler4r8r8r9�compile_template_str�s�
r@cCs�d}|dkr
|��d}n!tjj�|d��}tjj�|���}Wd�n1s)wY|�d�rE|�d�sEt	|�
�dd�|||�St	||||�S)	aY
    Check the template shebang line and return the list of renderers specified
    in the pipe.

    Example shebang lines::

      #!yaml_jinja
      #!yaml_mako
      #!mako|yaml
      #!jinja|yaml
      #!jinja|mako|yaml
      #!mako|yaml|stateconf
      #!jinja|yaml|stateconf
      #!mako|yaml_odict
      #!mako|yaml_odict|stateconf

    rrr�rNz#!z#!/�)r&rrrr<ZstringutilsZ
to_unicode�readline�
startswith�check_render_pipe_strr)r.rr/r0r1r2�liner5r8r8r9r�s�r)	Z
yaml_jinjaZ	yaml_makoZ
yaml_wempyZ
json_jinjaZ	json_makoZ
json_wempyZyamlex_jinjaZyamlexyamlex_makoZyamlexyamlex_wempy�_�|c	Cs�|durgSdd�|�d�D�}g}zA|d|kr$|tvr$t|�d�}|D]*}|d�dd�\}}|r8||vs>|rE||vrEt�d|�q&|�|||��f�q&|WStydt�d	|�gYSw)
z�
    Check that all renderers specified in the pipe string are available.
    If so, return the list of render functions in the pipe as
    (render_func, arg_str) tuples; otherwise return [].
    NcSsg|]}|���qSr8)r)�.0rAr8r8r9�
<listcomp>�sz)check_render_pipe_str.<locals>.<listcomp>rHr� �zEThe renderer "%s" is disallowed by configuration and will be skipped.z"The renderer "%s" is not available)r&�OLD_STYLE_RENDERERSr
�warning�appendr�KeyErrorr)	Zpipestrrr0r1�parts�results�part�namer	r8r8r9rE�s*��rE)rrrN)�__doc__rrr)rr$Zsalt.utils.datarZsalt.utils.filesZsalt.utils.sanitizersZsalt.utils.stringioZsalt.utils.versions�	getLogger�__name__r
r�
getencoderr>r:r@rrM�combr&�fmtZtmplrEr8r8r8r9�<module>s4

	
�v
'