HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //lib/python3.9/site-packages/ansible/plugins/action/__pycache__/template.cpython-39.pyc
a

�)g�&�@s�ddlmZmZmZeZddlZddlZddlZddl	Z	ddl
mZddl
mZddlmZmZmZmZddlmZmZmZddlmZddlmZdd	lmZdd
lmZm Z Gdd�de�Z!dS)
�)�absolute_import�division�print_functionN)�	constants)�ensure_type)�AnsibleError�AnsibleFileNotFound�
AnsibleAction�AnsibleActionFail)�to_bytes�to_text�	to_native)�boolean)�string_types)�
ActionBase)�generate_ansible_template_vars�AnsibleEnvironmentcs&eZdZdZdZd�fdd�	Z�ZS)�ActionModuleT�
Nc's�|durt�}tt|��||�}~dD]T}||jjvr&t|jj|d�}|durnt|t�snt	d|t
|�f��||jj|<q&zLt|jj�dd�dd�}t|jj�dd	�dd�}t|jj�d
d�dd�}Wn0t
y�}	zt	t|	���WYd}	~	n
d}	~	00|jj�dd�}
|jj�dd�}|jj�d
d�}|jj�d|j�}
|jj�dd�}|jj�dd�}|jj�dd�}|jj�dd�}|jj�dd�}|jj�dd�}|jj�dd��p�d}gd�}gd�}|
|v�r�||�|
�}
�z�z�|du�r�t	d��nv|
du�s
|du�rt	d��nX|
|v�r(t	d��nDz|�d|
�}
Wn2t�yj}	zt	t|	���WYd}	~	n
d}	~	00|jj�dd�}|dk�r�dt�t�|
�j�}z|j�|
�}Wn:t�y�}	z t	d |
t|	�f��WYd}	~	n
d}	~	00t|d!d"�}�z|�zt|d#��B}zt|��d!d"�}Wnt�y8t	d$��Yn0Wd�n1�sP0Y|�d%g�}|�|jj tj!�"|
�g�g}|D]$}|�#tj!�$|d��|�#|��q�|}|�%�}|�&t'|jj�dd�|
|��|j(j)t*||
|||||||||d&�} | j+|d	dd'�}!WnTt,�y$�Yn@t-�yb}	z&t	d(t
|	�j.t|	�f��WYd}	~	n
d}	~	00W|j�/|�n|j�/|�0|j�%�}"||"jd<d)D]}#|"j�0|#d��q�t1j2t3j4d*�}$z�tj!�$|$tj!�5|
��}%tt|%d!d"�d+��$}|�6t|!|d!d,��Wd�n1�s0Y|"j�&t|%||d-��|j7j8jd.|"|j9|j:|j|j(|j7d/�}&|�&|&j|d0��Wt;�<t|$d!d"��nt;�<t|$d!d"��0Wn2t,�y�}	z|�&|	j=�WYd}	~	n
d}	~	00W|�>|j9j?j@�n|�>|j9j?j@�0|S)1z! handler for template operations N)
�src�dest�state�newline_sequence�variable_start_string�variable_end_string�block_start_string�block_end_string�comment_start_string�comment_end_string�stringz1%s is expected to be a string, but got %s instead�followF)�strict�trim_blocksT�
lstrip_blocksrrrrrrrrrr�output_encodingzutf-8)z\nz\rz\r\n)r�
z
z)'state' cannot be specified on a templatezsrc and dest are requiredz/newline_sequence needs to be one of: 
, 
 or 
Z	templates�modeZpreservez0%03ozcould not find src=%s, %sZsurrogate_or_strict)�errors�rbz+Template source files must be utf-8 encodedZansible_search_path)Zenvironment_class�
searchpathrrrrrrrr"r#Zavailable_variables)Zpreserve_trailing_newlinesZescape_backslashesz%s: %s)
rrrrrrrr"r#r$)�dir�wb)�encodingr')rrr zansible.legacy.copy)ZtaskZ
connectionZplay_context�loader�templarZshared_loader_obj)�	task_vars)A�dict�superr�runZ_task�argsr�
isinstancerr
�typer�get�	TypeErrorr
�DEFAULT_NEWLINE_SEQUENCE�indexZ_find_needlerr�stat�S_IMODE�os�st_modeZ_loaderZ
get_real_filerr�open�read�UnicodeError�extendZ_basedir�path�dirname�append�join�copy�updaterZ_templarZcopy_with_new_envrZdo_templater	�	Exception�__name__Zcleanup_tmp_file�pop�tempfileZmkdtemp�CZDEFAULT_LOCAL_TMP�basename�writeZ_shared_loader_objZ
action_loaderZ_connectionZ
_play_context�shutil�rmtree�resultZ_remove_tmp_pathZ_shellZtmpdir)'�self�tmpr/rQZs_type�valuer r"r#�e�sourcerrrrrrrrrr$Zwrong_sequencesZallowed_sequencesr&Z
tmp_sourceZb_tmp_source�fZ
template_datar)Z
newsearchpath�pZ	temp_varsr.Z	resultantZnew_task�removeZ
local_tempdirZresult_fileZcopy_action��	__class__��C/usr/lib/python3.9/site-packages/ansible/plugins/action/template.pyr2s�"





"
*.�2

4��
�,$$zActionModule.run)NN)rI�
__module__�__qualname__ZTRANSFERS_FILESr8r2�
__classcell__r\r\rZr]rsr)"Z
__future__rrrr5Z
__metaclass__r<rOr:rKZansiblerrLZansible.config.managerrZansible.errorsrrr	r
Zansible.module_utils._textrrr
Z)ansible.module_utils.parsing.convert_boolrZansible.module_utils.sixrZansible.plugins.actionrZansible.templaterrrr\r\r\r]�<module>s