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/connection/__pycache__/local.cpython-39.pyc
a

�)g; �@s�ddlmZmZmZeZdZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZddlmZmZddlmZddlmZmZddlmZmZmZddlmZdd	lmZdd
l m!Z!e�Z"Gdd�de�Z#dS)
�)�absolute_import�division�print_functiona�
    name: local
    short_description: execute on controller
    description:
        - This connection plugin allows ansible to execute tasks on the Ansible 'controller' instead of on a remote host.
    author: ansible (@core)
    version_added: historical
    extends_documentation_fragment:
        - connection_pipelining
    notes:
        - The remote user is ignored, the user with which the ansible CLI was executed is used instead.
N)�AnsibleError�AnsibleFileNotFound)�	selectors)�	text_type�binary_type)�to_bytes�	to_native�to_text)�ConnectionBase)�Display)�unfrackpathcs^eZdZdZdZdZ�fdd�Zdd�Zd�fd	d
�	Z�fdd�Z	�fd
d�Z
dd�Z�ZS)�
Connectionz Local based connections �localTcsZtt|�j|i|��d|_zt��|_Wn*tyTt�	dt
���d|_Yn0dS)NzPCurrent user (uid=%s) does not seem to exist on this system, leaving user empty.�)�superr�__init__�cwd�getpassZgetuser�default_user�KeyError�displayZvv�os�getuid)�self�args�kwargs��	__class__��D/usr/lib/python3.9/site-packages/ansible/plugins/connection/local.pyr.szConnection.__init__cCs6|j|j_|js2tjd�|jj�|jjd�d|_|S)z/ connect to the local host; nothing to do here z(ESTABLISH LOCAL CONNECTION FOR USER: {0}��hostT)r�
_play_contextZremote_user�
_connectedr�vvv�format�remote_addr�rr!r!r"�_connect8s

zConnection._connectNc
s�tt|�j|||d�t�d�tjr4tj��dnd}tj	�
t|dd��sXtd|��tj
d�t|��|jjd	�t�d
�t|ttf�r�t|�}n
tt|�}d}tj}|�r|j�r|j���r|�d��szt��\}}Wn<ttf�y}zt�dt|��WYd}~n
d}~00tj |t|ttf�||j!|tjtjd
�}|du�rZt�"|�t�d�|j�rn|j���rn|�rnt#�#|j$t#j%t#�#|j$t#j&�tj'B�t#�#|j(t#j%t#�#|j(t#j&�tj'B�t)�*�}	|	�+|j$t)j,�|	�+|j(t)j,�d}
z�|j�-|
��s�|j�.|
��s�|	�/|jj0�}|�s@|�1�\}}
tdt|
���|D]<\}}|j2|j$k�rf|j$�3�}n|j2|j(k�rD|j(�3�}�qD|�s�|�1�\}}
tdt|
���|
|7}
�q�W|	�"�n
|	�"�0|j�-|
��s"|jjd|jd�}|du�r
|j4�5t|dd�d�nt�5|t|dd�d�t#�#|j$t#j%t#�#|j$t#j&�tj'@�t#�#|j(t#j%t#�#|j(t#j&�tj'@�t�d�|�1|�\}}
t�d�|�r�t�"|�t�d�|j6||
fS)z! run a command on the local host )�in_data�sudoablezin local.exec_command()rN�surrogate_or_strict��errorsz^failed to find the executable specified %s. Please verify if the executable exists and re-try.zEXEC {0}r#zopening command with Popen()Z
pipeliningzUnable to open pty: %s)�shell�
executabler�stdin�stdout�stderrz!done running command with Popen()�z:timeout waiting for privilege escalation password prompt:
z;privilege output closed while waiting for password prompt:
�become_pass)Zplaycontext�
z!getting output with communicate()zdone communicatingzdone with local.exec_command())7rr�exec_commandr�debug�CZDEFAULT_EXECUTABLE�splitr�path�existsr
rr'r(rr%r)�
isinstancerr	�map�
subprocess�PIPEZbecomeZ
expect_promptZ
get_option�pty�openpty�IOError�OSErrorr�Popenr�close�fcntlr4ZF_SETFLZF_GETFL�
O_NONBLOCKr5rZDefaultSelector�registerZ
EVENT_READZ
check_successZcheck_password_promptZselect�timeoutZcommunicateZfileobj�readr3�write�
returncode)r�cmdr,r-r2Zmasterr3�e�p�selectorZ
become_outputZeventsr4r5�keyZevent�chunkr7rr!r"r9Ds�
�


&(�


$$
&&



zConnection.exec_commandc
s�tt|��||�t||jd�}t||jd�}tjd�||�|jj	d�t
j�t
|dd��sntd�t|����z t�t
|dd�t
|dd��Wnftjy�td�t|�t|����Yn<ty�}z$td�t|�t|����WYd	}~n
d	}~00d	S)
z% transfer a file from local to local )ZbasedirzPUT {0} TO {1}r#r.r/z"file or module does not exist: {0}z(failed to copy: {0} and {1} are the samez#failed to transfer file to {0}: {1}N)rr�put_filerrrr'r(r%r)rr=r>r
rr�shutil�copyfile�ErrorrrE)r�in_path�out_pathrQrr!r"rV�s zConnection.put_filecs<tt|��||�tjd�||�|jjd�|�||�dS)z7 fetch a file from local to local -- for compatibility zFETCH {0} TO {1}r#N)	rr�
fetch_filerr'r(r%r)rV)rrZr[rr!r"r\�szConnection.fetch_filecCs
d|_dS)z. terminate the connection; nothing to do here FN)r&r*r!r!r"rH�szConnection.close)NT)
�__name__�
__module__�__qualname__�__doc__Z	transportZhas_pipeliningrr+r9rVr\rH�
__classcell__r!r!rr"r(s
br)$Z
__future__rrr�typeZ
__metaclass__Z
DOCUMENTATIONrIrrrCrWrAZansible.constantsZ	constantsr;Zansible.errorsrrZansible.module_utils.compatrZansible.module_utils.sixrr	Zansible.module_utils._textr
rrZansible.plugins.connectionr
Zansible.utils.displayrZansible.utils.pathrrrr!r!r!r"�<module>s$