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/playbook/__pycache__/block.cpython-39.pyc
a

�)g�A�@s�ddlmZmZmZeZddlmZddl	m
Z
ddlmZm
Z
ddlmZddlmZddlmZddlmZdd	lmZdd
lmZddlmZGdd
�d
eeee�ZdS)�)�absolute_import�division�print_functionN)�AnsibleParserError)�FieldAttribute�NonInheritableFieldAttribute)�Base)�Conditional)�CollectionSearch)�load_list_of_tasks)�Role)�Taggable)�Sentinelcs2eZdZeded�Zeded�Zeded�Zedd�Z	edd�Z
edd�Zd8�fdd	�	Zd
d�Z
dd
�Zdd�Zdd�Zed9dd��Zedd��Z�fdd�Zdd�Zdd�Zdd�Zdd�ZeZd d!�Zd:�fd"d#�	Zd$d%�Zd&d'�Zd(d)�Zd;d*d+�Zd,d-�Z d.d/�Z!d0d1�Z"d2d3�Z#d4d5�Z$d6d7�Z%�Z&S)<�Block�list)�isa�default)r�string�boolNFcsL||_||_d|_d|_||_||_|r0||_n
|r:||_tt|���dS�N)	�_play�_role�_parent�
_dep_chain�
_use_handlersZ	_implicit�superr�__init__)�self�play�parent_block�role�task_include�use_handlers�implicit��	__class__��:/usr/lib/python3.9/site-packages/ansible/playbook/block.pyr2szBlock.__init__cCsd|jt|�|jfS)Nz BLOCK(uuid=%s)(id=%s)(parent=%s))�_uuid�idr�rr&r&r'�__repr__AszBlock.__repr__cCs|j|jkS�z object comparison based on _uuid�r(�r�otherr&r&r'�__eq__DszBlock.__eq__cCs|j|jkSr,r-r.r&r&r'�__ne__HszBlock.__ne__cCs*i}|jr||j��O}||j��O}|S)z�
        Blocks do not store variables directly, however they may be a member
        of a role or task include which does, so return those if present.
        )r�get_vars�vars�copy�r�all_varsr&r&r'r2Ls
zBlock.get_varsc
Cs0t�|�}t||||||d�}	|	j|||d�S)N)rrr r!r"r#)�variable_manager�loader)r�is_blockZ	load_data)
�datarrr r!r"r7r8r#�br&r&r'�load[sz
Block.loadcCs,d}t|t�r(dD]}||vrd}q(q|S)NF��block�rescue�alwaysT)�
isinstance�dict)�dsr9�attrr&r&r'r9as
zBlock.is_blockcsRt�|�sBt|t�r*tt|��t|d��Stt|��t|gd��Stt|��|�S)z�
        If a simple task is given, an implicit block for that single task
        is created, which goes in the main portion of the block
        )r>)rr9rArr�preprocess_datarB)rrCr$r&r'rEks


zBlock.preprocess_datac
Cs^z$t||j||jd|j|j|jd�WStyX}ztd|j|d��WYd}~n
d}~00dS)N�rr>r r!r7r8r"z7A malformed block was encountered while loading a block��objZorig_exc�	rrrZ_variable_manager�_loaderr�AssertionErrorr�_ds�rrDrC�er&r&r'�_load_blockys�
zBlock._load_blockc
Cs^z$t||j||jd|j|j|jd�WStyX}ztd|j|d��WYd}~n
d}~00dS)NrFz7A malformed block was encountered while loading rescue.rGrIrMr&r&r'�_load_rescue�s�
zBlock._load_rescuec
Cs^z$t||j||jd|j|j|jd�WStyX}ztd|j|d��WYd}~n
d}~00dS)NrFz6A malformed block was encountered while loading alwaysrGrIrMr&r&r'�_load_always�s�
zBlock._load_alwayscCs |r|jstd||jd��dS)Nz+'%s' keyword cannot be used without 'block')rH)r>rrL)rrD�name�valuer&r&r'�_validate_always�s
zBlock._validate_alwayscCs2|jdur |jr|j��SdSn|jdd�SdSr)rr�
get_dep_chainr*r&r&r'rU�s


zBlock.get_dep_chaincs�dd�}tt|���}|j|_|j|_|jdur@|jdd�|_d|_|jr`|s`|jjdd�|_|s�||jpng|�|_||jp�g|�|_||j	p�g|�|_	d|_
|j
r�|j
|_
|��|S)NcSs|g}|D]n}|jdd�}|jrf|jjdd�|_|j|kr@||_ql|j}|jr^|j|kr^|j}qF||_n||_|�|�q|S)NT)�exclude_parent��
exclude_tasks)r4r�append)Z	task_list�	new_blockZ
new_task_list�taskZnew_taskZcur_objr&r&r'�_dupe_task_list�s
z#Block.copy.<locals>._dupe_task_listTrW)rrr4rrrrr>r?r@rZvalidate)rrVrXr\Znew_mer$r&r'r4�s$

z
Block.copycCs~t�}|jD]}|dvrt||�||<q|��|d<|jdurL|j��|d<|jdurz|jjdd���|d<|jjj	|d<|S)	z�
        Override of the default serialize method, since when we're serializing
        a task we don't want to include the attribute list of tasks.
        r=�	dep_chainNr TrW�parent�parent_type)
rB�fattributes�getattrrUr�	serializerr4r%�__name__)rr:rDr&r&r'rb�s


zBlock.serializec
Cs�ddlm}ddlm}|jD]&}||vr|dvrt|||�|��q|�dd�|_|�d�}|rxt�}|�	|�||_
|�d�}|r�|�d	�}|d
kr�t�}	n|dkr�|�}	n|dkr�|�}	|	�	|�|	|_|j�
�|_dS)
zt
        Override of the default deserialize method, to match the above overridden
        serialize method
        r��TaskInclude)�HandlerTaskIncluder=r]Nr r^r_rrerf)�ansible.playbook.task_includereZ%ansible.playbook.handler_task_includerfr`�setattr�getrr�deserializerrrrU)
rr:rerfrDZ	role_data�rZparent_datar_�pr&r&r'rj�s.





zBlock.deserializecCsP||_|jr|j�|�n|jr,|j�|�|��}|rL|D]}|�|�q<dSr)rJr�
set_loaderrrU)rr8r]�depr&r&r'rmszBlock.set_loaderc
Cs |j|}|j}|j}�z�|r$t}nt|d|��t�}t|jdd�rL|j}n|jj}|r�|tusd|r�zPt|dd�r�t|d�r�|�|�}nt|d|��t�}|r�|�|||�}n|}Wnt	y�Yn0|j
�r�|tus�|�r�z�t|j
d|��t�}|�r
|�|||�}n|}|��}	|	�r�|tu�s,|�r�|	��|	D]H}
t|
d|��t�}|�rd|�|||�}n|}|tu�r8|�s8�q��q8Wnt	�y�Yn0|j
�r|tu�s�|�rz<t|j
d|��t�}|tu�r�|�r�|�|||�}n|}Wnt	�yYn0Wnt�yYn0|S)z[
        Generic logic to get the attribute or parent attribute for a block value.
        �_�statically_loadedT�_get_parent_attribute)r`�extend�prependrrar�hasattrrqZ
_extend_value�AttributeErrorrrU�reverser�KeyError)
rrDZomitZfattrrrrsrSrZparent_valuer]rnZ	dep_valueZ
play_valuer&r&r'rq)sf



zBlock._get_parent_attributecs$���fdd���fdd�����S)zR
        Creates a new block, with task lists filtered based on the tags.
        cs�g}|D]~}t|t�r2�|�}|��r�|�|�q|jtjvrD|js||jtjvrd|j	g�j
j�d�s||j	�j
j�j
j�d�r|�|�q|S)N)r6)
rAr�	has_tasksrY�action�CZ_ACTION_METAr#Z_ACTION_INCLUDEZ
evaluate_tagsrZ	skip_tagsZ	only_tags)�target�tmp_listr[Zfiltered_block)r6�evaluate_blockrr&r'�evaluate_and_append_taskws

���z;Block.filter_tagged_tasks.<locals>.evaluate_and_append_taskcs>|jddd�}|j|_�|j�|_�|j�|_�|j�|_|S)NT)rVrX)r4rr>r?r@)r>rZ�r~r&r'r}�sz1Block.filter_tagged_tasks.<locals>.evaluate_blockr&r5r&)r6r~r}rr'�filter_tagged_tasksrs
zBlock.filter_tagged_taskscs �fdd���fdd���|�S)Ncs6g}|D](}t|t�r&|��|��q|�|�q|Sr)rArrrrY)r{r|r[)r}r&r'r~�s
z1Block.get_tasks.<locals>.evaluate_and_append_taskcs.�|j�}|��|j��|��|j��|Sr)r>rrr?r@)r>�rvrr&r'r}�s
z'Block.get_tasks.<locals>.evaluate_blockr&r*r&)r~r}r'�	get_tasks�s	zBlock.get_taskscCs*t|j�dkp(t|j�dkp(t|j�dkS)Nr)�lenr>r?r@r*r&r&r'rx�szBlock.has_taskscCs|jr|j��St�SdSr)r�get_include_paramsrBr*r&r&r'r��s
zBlock.get_include_paramscCs8ddlm}|jr4t|j|�r*|jjs*dS|j��SdS)a7
        Determine if all of the parents of this block were statically loaded
        or not. Since Task/TaskInclude objects may be in the chain, they simply
        call their parents all_parents_static() method. Only Block objects in
        the chain check the statically_loaded value of the parent.
        rrdFT)rgrerrArp�all_parents_static�rrer&r&r'r��s
zBlock.all_parents_staticcCs2ddlm}|jr.t|j|�r$|jS|j��SdS)Nrrd)rgrerrA�get_first_parent_includer�r&r&r'r��s
zBlock.get_first_parent_include)NNNNFF)NNNNFNN)FF)F)'rc�
__module__�__qualname__rrr>r?r@r�notifyZdelegate_toZdelegate_factsrr+r0r1r2�staticmethodr<r9rErOrPrQrTZ_validate_rescuerUr4rbrjrmrqr�r�rxr�r�r��
__classcell__r&r&r$r'r"sB



		-&
Ir)Z
__future__rrr�typeZ
__metaclass__Zansible.constantsZ	constantsrzZansible.errorsrZansible.playbook.attributerrZansible.playbook.baserZansible.playbook.conditionalr	Z!ansible.playbook.collectionsearchr
Zansible.playbook.helpersrZansible.playbook.rolerZansible.playbook.taggabler
Zansible.utils.sentinelrrr&r&r&r'�<module>s