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: //usr/lib/python3.9/site-packages/ansible/executor/process/__pycache__/worker.cpython-39.pyc
a

�)g�"�@s�ddlmZmZmZeZddlZddlZddlZddl	m
Z
ddlmZddl
mZddlmZddlmZddlmZd	gZe�ZGd
d	�d	ej�ZdS)�)�absolute_import�division�print_functionN)�TemplateNotFound)�AnsibleConnectionFailure)�TaskExecutor)�to_text)�Display)�context�
WorkerProcesscsTeZdZdZ�fdd�Zdd�Z�fdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
�ZS)rz�
    The worker thread class, which uses TaskExecutor to run tasks
    read from a job queue and pushes results into a results queue
    for reading later.
    c		sLtt|���||_||_||_||_||_||_||_	||_
t�|j_dS�N)
�superr�__init__�_final_q�
_task_vars�_host�_task�
_play_context�_loaderZ_variable_manager�_shared_loader_obj�setZ
_tempfiles)	�selfZfinal_qZ	task_vars�hostZtaskZplay_context�loaderZvariable_managerZshared_loader_obj��	__class__��C/usr/lib/python3.9/site-packages/ansible/executor/process/worker.pyr.szWorkerProcess.__init__c	Cs�d|_zLtj��rPtj��durPzt�t�tj����|_WntyNYn0Wnt	t
fyhYn0|jdur�ttj�|_dSr)
�
_new_stdin�sys�stdin�isatty�fileno�os�fdopen�dup�OSError�AttributeError�
ValueError�open�devnull�rrrr�_save_stdin?s

zWorkerProcess._save_stdinc	sh|��tj�Fz(tt|���W|j��Wd�S|j��0Wd�n1sZ0YdS)al
        multiprocessing.Process replaces the worker's stdin with a new file
        but we wish to preserve it if it is connected to a terminal.
        Therefore dup a copy prior to calling the real start(),
        ensuring the descriptor is preserved somewhere in the new child, and
        make sure it is closed in the parent when start() completes.
        N)r,�display�_lockr
r�startr�closer+rrrr/Ps	
�zWorkerProcess.startcCs8zt�dt|��Wnty(Yn0t�d�dS)a
        There is no safe exception to return to higher level code that does not
        risk an innocent try/except finding itself executing in the wrong
        process. All code executing above WorkerProcess.run() on the stack
        conceptually belongs to another program.
        zWORKER HARD EXIT: %s�N)r-�debugr�
BaseExceptionr#�_exit�r�errr�
_hard_exitas
zWorkerProcess._hard_exitc
Cs�zhz |��WWttjd�t_t_StyP}z|�|�WYd}~n
d}~00Wttjd�t_t_nttjd�t_t_0dS)a�
        Wrap _run() to ensure no possibility an errant exception can cause
        control to return to the StrategyBase task loop, or any other code
        higher in the stack.

        As multiprocessing in Python 2.x provides no protection, it is possible
        a try/except added in far-away code can cause a crashed child process
        to suddenly assume the role and prior state of its parent.
        �wN)	�_runr)r#r*r�stdout�stderrr3r7r5rrr�runss

�"zWorkerProcess.runcCst�|j�z�t�d|j|jf�t|j|j|j|j|j	|j
|j|j���}t�d|j|j|jj
f�t�|j_g|j_t�d|jj
�|jj|jj|jj
||j��d�t�d|jj
�W�n2t�yt�|j_g|j_|jj|jj|jj
tdd�|j��d�Yn�t�y�}z�t|ttttf��rDt|t��r�z�zJt�|j_g|j_|jj|jj|jj
tdtt���dd	�|j��d�Wn<t�y�t�d
t|��t�dtt����Yn0W|��n
|��0WYd}~n
d}~00t�d
�dS)z�
        Called when the process is started.  Pushes the result onto the
        results queue. We also remove the host from the blocked hosts list, to
        signify that they are ready for their next task.
        z running TaskExecutor() for %s/%sz*done running TaskExecutor() for %s/%s [%s]zsending task result for task %s)Ztask_fieldsz$done sending task result for task %sT)Zunreachable�)Zfailed�	exceptionr:zWORKER EXCEPTION: %szWORKER TRACEBACK: %sNzWORKER PROCESS EXITING) r-Z	set_queuerr2rrrrrrrrr<Z_uuid�dict�vars�groupsZsend_task_result�nameZ
dump_attrsr�	Exception�
isinstance�IOError�EOFError�KeyboardInterrupt�
SystemExitrr�	traceback�
format_exc�	_clean_up)rZexecutor_resultr6rrrr9�sb�
�
�
 
�
*zWorkerProcess._runcCs|j��dSr)rZcleanup_all_tmp_filesr+rrrrK�szWorkerProcess._clean_up)�__name__�
__module__�__qualname__�__doc__rr,r/r7r<r9rK�
__classcell__rrrrr'sO)Z
__future__rrr�typeZ
__metaclass__r#rrIZjinja2.exceptionsrZansible.errorsrZansible.executor.task_executorrZansible.module_utils._textrZansible.utils.displayr	Zansible.utils.multiprocessingr
Zmultiprocessing_context�__all__r-ZProcessrrrrr�<module>s