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: //proc/self/root/usr/lib/python3.9/site-packages/ansible/playbook/__pycache__/task.cpython-39.pyc
a

�)g6S�@s*ddlmZmZmZeZddlmZddl	m
Z
mZmZm
Z
ddlmZddlmZddlmZddlmZmZddlmZdd	lmZmZdd
lmZddlmZddl m!Z!dd
l"m#Z#ddl$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/dgZ0e-�Z1Gdd�dee#e)e!�Z2dS)�)�absolute_import�division�print_function)�	constants)�AnsibleError�AnsibleParserError�AnsibleUndefinedVariable�AnsibleAssertionError)�	to_native)�string_types)�ModuleArgsParser)�AnsibleBaseYAMLObject�AnsibleMapping)�
lookup_loader)�FieldAttribute�NonInheritableFieldAttribute)�Base)�Block)�CollectionSearch)�Conditional)�LoopControl)�Role)�Taggable)�AnsibleCollectionConfig)�Display)�Sentinel�Taskcs�eZdZdZeded�Zedd�Zedddd	�Zed
e	d�Z
eddd�Zedd�Z
edd�Zed
e	d�Ze�Zed
eed�Zed
d�Zedejd�Zeddd�Zeddd�Zed
e	d�Zeddd�ZdK�fdd�	ZdLdd�Zdd�ZedMdd��Zdd�Z dd�Z!�fd d!�Z"d"d#�Z#�fd$d%�Z$d&d'�Z%d(d)�Z&�fd*d+�Z'd,d-�Z(d.d/�Z)d0d1�Z*d2d3�Z+d4d5�Z,d6d7�Z-d8d9�Z.d:d;�Z/dN�fd=d>�	Z0�fd?d@�Z1�fdAdB�Z2dCdD�Z3dOdEdF�Z4dGdH�Z5dIdJ�Z6�Z7S)Prz�
    A task is a language feature that represents a call to a module, with given arguments and other parameters.
    A handler is a subclass of a task.

    Usage:

       Task.load(datastructure) -> Task
       Task.something(...)
    �dict)�isa�default�string)r�intr�async)rr�alias�list��bool�class)rZ
class_typerT)rZstatic�)rZprivateNcs<||_d|_d|_d|_|r$||_n||_tt|���dS)zQ constructors a task, without the Task.load classmethod, it will be pretty blank NF)�_role�_parent�implicit�resolved_action�superr�__init__)�self�block�role�task_include��	__class__��9/usr/lib/python3.9/site-packages/ansible/playbook/task.pyr.Ysz
Task.__init__cCs^|jr|jj|d�}|jr.|jr.d||jfS|jr:|jS|jrNd||jfSd|jfSdS)z return the name of the task )�include_role_fqcnz%s : %sz%sN)r)�get_name�name�action)r/r7Z	role_namer5r5r6r8hsz
Task.get_namecCsf|durdSt|t�r|St|t�rbd}|��D]$\}}|�d�rDq0|d||f}q0|��}|SdS)N��_z%s=%s )�
isinstancerr�items�
startswith�strip)r/�ds�buf�k�vr5r5r6�	_merge_kvxs


zTask._merge_kvcCst|||d�}|j|||d�S)N)r0r1r2)�variable_manager�loader)rZ	load_data)�datar0r1r2rFrG�tr5r5r6�load�sz	Task.loadcCs,|��tjvrd|jdSd|��SdS)z5 returns a human readable representation of the task zTASK: meta (%s)�_raw_paramszTASK: %sN)r8�CZ_ACTION_META�args�r/r5r5r6�__repr__�sz
Task.__repr__cCsb|�d�}|�d�dus&|�d�dur6td||d��|durNtd||d��||d<||d<dS)z2 take a lookup plugin name and store it correctly �with_�loopN�	loop_withzduplicate loop in task: %s��objz&you must specify a value when using %s)�removeprefix�getr)r/rA�new_dsrCrDZ	loop_namer5r5r6�_preprocess_with_loop�s
zTask._preprocess_with_loopc
sRt|t�std|t|�f��t�}t|t�r6|j|_tj}|�	d�}|durV|j
}n|�d|j�	d�|d�}|r�|j
s�|r�||vr�|�d|�n|g}|r�d|vr�d|vr�|�d�|r�||d<t||d�}z|��\}}}Wn@t�y }	z&|	jr��tt|	�||	d��WYd}	~	nd}	~	00|j|_|tjv�rld	|v�rl|�	d
d�dk�r^td|d
��|�d	�|d
<||d<||d<||d<d|v�r�|�d|�	d��|d<n
t�|d<|��D]�\}
}|
dv�s�|
|k�s�|
dk�r�q�nZ|
�d��r|
�d�tv�r|�|||
|�n,tj �s&|
|jv�r0|||
<nt!�"d|
��q�t#t$|��%|�S)zg
        tasks are especially complex arguments so need pre-processing.
        keep it short.
        z%ds (%s) should be a dict but was a %s�collectionsNrzansible.builtinzansible.legacy)Ztask_dsZcollection_list)rTZorig_exc�cmdrKr;z{The 'cmd' argument cannot be used when other raw parameters are specified. Please put everything in one or the other place.rSr:rM�delegate_to�vars)r:Zlocal_actionrMr[�shellrPzIgnoring invalid attribute: %s)&r=rr	�typerr
Zansible_posr�default_collectionrVrYZget_validated_value�fattributesr)�insert�appendr�parserrTr
r,rLZ_ACTION_HAS_CMDr�popZ
_load_varsr>r?rUrrXZINVALID_TASK_ATTRIBUTE_FAILED�display�warningr-r�preprocess_data)r/rArWr_Zcollections_listZargs_parserr:rMr[�erCrDr3r5r6rg�sb




(
�


zTask.preprocess_datacCs*t|t�std|d��tj||j|jd�S)Nz|the `loop_control` value must be specified as a dictionary and cannot be a variable itself (though it can contain variables)rS)rHrFrG)r=rrrrJZ_variable_manager�_loader)r/�attrrAr5r5r6�_load_loop_control�s
�zTask._load_loop_controlc
sPztt|��|�Wn6tyJ}z|jd7_|�WYd}~n
d}~00dS)Nzb
This error can be suppressed as a warning using the "invalid_task_attribute_failed" configuration)r-r�_validate_attributesr�message)r/rArhr3r5r6rls
zTask._validate_attributescCst|t�st|||g�dS�N�r=r$�setattr�r/rjr9�valuer5r5r6�_validate_changed_whens
zTask._validate_changed_whencCst|t�st|||g�dSrnrorqr5r5r6�_validate_failed_whens
zTask._validate_failed_whencs,|jr|j�|�tjrtt|��|�dS)z�
        Override of base class post_validate, to also do final validation on
        the block and task include (if any) to which this task belongs.
        N)r*�
post_validaterr_r-r)r/�templarr3r5r6ruszTask.post_validatecCs`||_|�|�}d|vr\|�d�}t|t�rLtjr<t�d�|�	|�|}nt
d|�d���|S)NZ_variable_paramsz�Using a variable for a task's 'args' is unsafe in some situations (see https://docs.ansible.com/ansible/devel/reference_appendices/faq.html#argsplat-unsafe)z invalid or malformed argument: '�')Zuntemplated_args�templaterdr=rrLZINJECT_FACTS_AS_VARSrerf�updater)r/rjrrrvrMZvariable_paramsr5r5r6�_post_validate_args%s




zTask._post_validate_argscCs|S)z�
        Override post validation for the loop field, which is templated
        specially in the TaskExecutor class when evaluating loops.
        r5�r/rjrrrvr5r5r6�_post_validate_loop=szTask._post_validate_loopcs�i�|dur����fdd�}t|t�r�|D]X}t|t�rR|D]}||||�q<q*�j|dd�}t|t�rt�|O�q*t�d|�q*n8t|t�r�t��|D]}||||�q�n�j|dd���S)zu
        Override post validation of vars on the play, as we don't want to
        template these too early.
        Nc
stz�j|dd��|<WnXtyn}z@t|�}�jtjvrBd|vsJd|vrXWYd}~dS�WYd}~n
d}~00dS)NF�Zconvert_barezansible_facts.envZansible_env)rxrr
r:rLZ_ACTION_FACT_GATHERING)rCrDrh�error��envr/rvr5r6�
_parse_env_kvLsz6Task._post_validate_environment.<locals>._parse_env_kvFr}z/could not parse environment value, skipping: %s)r=r$rrxrerf)r/rjrrrvr�Zenv_itemrCZisdictr5rr6�_post_validate_environmentDs$





zTask._post_validate_environmentcCs|S)z�
        changed_when is evaluated after the execution of the task is complete,
        and should not be templated during the regular post_validate step.
        r5r{r5r5r6�_post_validate_changed_whenmsz Task._post_validate_changed_whencCs|S)z�
        failed_when is evaluated after the execution of the task is complete,
        and should not be templated during the regular post_validate step.
        r5r{r5r5r6�_post_validate_failed_whentszTask._post_validate_failed_whencCs|S)z�
        until is evaluated after the execution of the task is complete,
        and should not be templated during the regular post_validate step.
        r5r{r5r5r6�_post_validate_until{szTask._post_validate_untilcCsDt�}|jr||j��O}||jO}d|vr2|d=d|vr@|d=|S)N�tagsZwhen)rr*�get_varsr\�r/Zall_varsr5r5r6r��s
z
Task.get_varscCs4t�}|jr||j��O}|jtjvr0||jO}|Srn)rr*�get_include_paramsr:rLZ_ACTION_ALL_INCLUDESr\r�r5r5r6r��s
zTask.get_include_paramsFcs^tt|���}d|_|jr.|s.|jj|d�|_d|_|jrB|j|_|j|_|j|_|j|_|S)N)�
exclude_tasks)r-r�copyr*r)r+r,Z_uuid)r/Zexclude_parentr�Znew_mer3r5r6r��s
z	Task.copycshtt|���}|jsd|jsd|jr<|j��|d<|jjj|d<|jrP|j��|d<|j	|d<|j
|d<|S)N�parent�parent_typer1r+r,)r-r�	serializeZ	_squashedZ
_finalizedr*r4�__name__r)r+r,)r/rHr3r5r6r��s

zTask.serializec	s�ddlm}ddlm}|�dd�}|rv|�d�}|dkrBt�}n|dkrR|�}n|dkr`|�}|�|�||_|d=|�d	�}|r�t�}|�|�||_	|d	=|�d
d�|_
|�d�|_tt
|��|�dS)
Nr��TaskInclude)�HandlerTaskIncluder�r�rr�r�r1r+Fr,)�ansible.playbook.task_includer�Z%ansible.playbook.handler_task_includer�rVr�deserializer*rr)r+r,r-r)	r/rHr�r�Zparent_datar��pZ	role_data�rr3r5r6r��s.



zTask.deserializecCs||_|jr|j�|�dS)z�
        Sets the loader on this object and recursively on parent, child objects.
        This is used primarily after the Task has been serialized/deserialized, which
        does not preserve the loader.
        N)rir*�
set_loader)r/rGr5r5r6r��szTask.set_loaderc	Cs�|j|}|j}|j}z�|r"t}nt|d|��t�}t|jdd�rJ|j}n|jj}|r�|tusb|r�t|dd�r�|dkr�t|d�r�|�|�}nt|d|��t�}|r�|�|||�}n|}Wnt	y�Yn0|S)zZ
        Generic logic to get the attribute or parent attribute for a task value.
        r<Zstatically_loadedTr\�_get_parent_attribute)
r`�extend�prependr�getattrr*�hasattrr�Z
_extend_value�KeyError)	r/rjZomitZfattrr�r�rrr*Zparent_valuer5r5r6r��s*
zTask._get_parent_attributecCs|jr|j��SdS)NT)r*�all_parents_staticrNr5r5r6r�s
zTask.all_parents_staticcCs2ddlm}|jr.t|j|�r$|jS|j��SdS)Nrr�)r�r�r*r=�get_first_parent_include)r/r�r5r5r6r�s
zTask.get_first_parent_include)NNN)T)NNNNN)FF)F)8r��
__module__�__qualname__�__doc__rrrMr:Z	async_valr$Zchanged_whenZdelayrr[Zdelegate_factsZfailed_whenrQrZloop_control�notifyrLZDEFAULT_POLL_INTERVALZpoll�registerZretriesZuntilrRr.r8rE�staticmethodrJrOrXrgrkrlrsrtrurzr|r�r�r�r�r�r�r�r�r�r�r�r�r��
__classcell__r5r5r3r6r.sZ





_
)
(N)3Z
__future__rrrr^Z
__metaclass__ZansiblerrLZansible.errorsrrrr	Zansible.module_utils._textr
Zansible.module_utils.sixrZansible.parsing.mod_argsrZansible.parsing.yaml.objectsr
rZansible.plugins.loaderrZansible.playbook.attributerrZansible.playbook.baserZansible.playbook.blockrZ!ansible.playbook.collectionsearchrZansible.playbook.conditionalrZansible.playbook.loop_controlrZansible.playbook.rolerZansible.playbook.taggablerZansible.utils.collection_loaderrZansible.utils.displayrZansible.utils.sentinelr�__all__rerr5r5r5r6�<module>s,