AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 3.143.241.89
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python2.7/site-packages/ansible/plugins/connection/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /lib/python2.7/site-packages/ansible/plugins/connection/zone.pyc
�
��\c@`sddlmZmZmZeZdZddlZddl	Z	ddl
Z	ddlZddlZddl
mZddlmZddlmZddlmZddlmZmZydd	lmZWn*ek
r�dd
lmZe�ZnXdefd��YZdS(
i(tabsolute_importtdivisiontprint_functions�
    author: Ansible Core Team
    connection: zone
    short_description: Run tasks in a zone instance
    description:
        - Run commands or put/fetch files to an existing zone
    version_added: "2.0"
    options:
      remote_addr:
        description:
            - Zone identifier
        default: inventory_hostname
        vars:
            - name: ansible_host
            - name: ansible_zone_host
N(t	constants(tAnsibleError(tshlex_quote(tto_bytes(tConnectionBasetBUFSIZE(tdisplay(tDisplayt
ConnectioncB`s�eZdZdZeZeej�j	d�Z
d�Zed��Z
d�Zd�Zd�Zejd�Zded	�Zd
�Zd�Zd�Zd
�ZRS(s Local zone based connections tzonetsucO`s�tt|�j||||�|jj|_tj�dkrOtd��nt	|j
d��|_t	|j
d��|_|j|j
�kr�td|j��ndS(Nis(zone connection requires running as roottzoneadmtzloginsincorrect zone name %s(tsuperRt__init__t
_play_contexttremote_addrRtostgeteuidRRt_search_executabletzoneadm_cmdt
zlogin_cmdt
list_zones(tselftplay_contextt	new_stdintargstkwargs((sC/usr/lib/python2.7/site-packages/ansible/plugins/connection/zone.pyR8scC`s/tjj|�}|s+td|��n|S(Ns%s command not found in PATH(t	distutilstspawntfind_executableR(t
executabletcmd((sC/usr/lib/python2.7/site-packages/ansible/plugins/connection/zone.pyRFscC`s�tj|jddgdtjdtjdtj�}g}xJ|jj�D]9}|jd�}|ddkrL|j|d�qLqLW|S(	Ntlists-iptstdintstdouttstderrt:itglobal(t
subprocesstPopenRtPIPER&t	readlinestsplittappend(Rtprocesstzonestlts((sC/usr/lib/python2.7/site-packages/ansible/plugins/connection/zone.pyRMs	cC`smtj|jdt|j�ddgdtjdtjdtj�}|jj�djd�d	}|d
S(Ns-zR$s-pR%R&R'iR(is/root(	R*R+RRRR,R&R-R.(RR0tpath((sC/usr/lib/python2.7/site-packages/ansible/plugins/connection/zone.pyt
get_zone_path[s
'	 cC`sBtt|�j�|js>tjdd|j�t|_ndS(s) connect to the zone; nothing to do here sTHIS IS A LOCAL ZONE DIRthostN(RRt_connectt
_connectedR	tvvvRtTrue(R((sC/usr/lib/python2.7/site-packages/ansible/plugins/connection/zone.pyR7fs	c
C`so|j|j|g}tt|�}tjd|d|j�tj|dtd|dtj	dtj	�}|S(s- run a command on the zone.  This is only needed for implementing
        put_file() get_file() so that we don't have to read the whole file
        into memory.

        compared to exec_command() it looses some niceties like being able to
        return the process's exit code immediately.
        sEXEC %sR6tshellR%R&R'(
RRtmapRR	R9R*R+tFalseR,(RR#R%t	local_cmdtp((sC/usr/lib/python2.7/site-packages/ansible/plugins/connection/zone.pyt_buffered_exec_commandmscC`sVtt|�j|d|d|�|j|�}|j|�\}}|j||fS(s run a command on the zone tin_datatsudoable(RRtexec_commandR@tcommunicatet
returncode(RR#RARBR?R&R'((sC/usr/lib/python2.7/site-packages/ansible/plugins/connection/zone.pyRC�s"cC`sC|jtjj�s3tjjtjj|�}ntjj|�S(s� Make sure that we put files into a standard path

            If a path is relative, then we need to choose where to put it.
            ssh chooses $HOME but we aren't guaranteed that a home dir will
            exist in any given chroot.  So for now we're choosing "/" instead.
            This also happens to be the former default.

            Can revisit using $HOME instead if it's a problem
        (t
startswithRR4tseptjointnormpath(Rtremote_path((sC/usr/lib/python2.7/site-packages/ansible/plugins/connection/zone.pyt_prefix_login_path�s
c
C`smtt|�j||�tjd||fd|j�t|j|��}y�t|d���}t	j
|j��js�d}nd}y&|j
d|t|fd|�}Wntk
r�td��nXy|j�\}}Wn'tj�td	||f��nX|jd
kr>td||||f��nWdQXWn!tk
rhtd
|��nXdS(s$ transfer a file from local to zone sPUT %s TO %sR6trbs count=0tsdd of=%s bs=%s%sR%s/jail connection requires dd command in the jails failed to transfer file %s to %sis'failed to transfer file %s to %s:
%s
%sNs$file or module does not exist at: %s(RRtput_fileR	R9RRRKtopenRtfstattfilenotst_sizeR@RtOSErrorRRDt	tracebackt	print_excREtIOError(Rtin_pathtout_pathtin_filetcountR?R&R'((sC/usr/lib/python2.7/site-packages/ansible/plugins/connection/zone.pyRN�s* 	&

)
c
C`sStt|�j||�tjd||fd|j�t|j|��}y|jd|t	f�}Wnt
k
r�td��nXt|d���}yB|j
jt	�}x)|r�|j|�|j
jt	�}q�WWn'tj�td||f��nX|j�\}}|jdkrItd||||f��nWd	QXd	S(
s! fetch a file from zone to local sFETCH %s TO %sR6sdd if=%s bs=%ss/zone connection requires dd command in the zoneswb+s failed to transfer file %s to %sis'failed to transfer file %s to %s:
%s
%sN(RRt
fetch_fileR	R9RRRKR@RRSRROR&treadtwriteRTRURDRE(RRWRXR?tout_filetchunkR&R'((sC/usr/lib/python2.7/site-packages/ansible/plugins/connection/zone.pyR[�s& 
	

cC`s tt|�j�t|_dS(s. terminate the connection; nothing to do here N(RRtcloseR=R8(R((sC/usr/lib/python2.7/site-packages/ansible/plugins/connection/zone.pyR`�s(R
N(t__name__t
__module__t__doc__t	transportR:thas_pipeliningt	frozensettCtBECOME_METHODSt
differencetbecome_methodsRtstaticmethodRRR5R7R*R,R@tNoneR=RCRKRNR[R`(((sC/usr/lib/python2.7/site-packages/ansible/plugins/connection/zone.pyR1s								(t
__future__RRRttypet
__metaclass__t
DOCUMENTATIONtdistutils.spawnRRtos.pathR*RTtansibleRRgtansible.errorsRtansible.module_utils.six.movesRtansible.module_utils._textRtansible.plugins.connectionRRt__main__R	tImportErrortansible.utils.displayR
R(((sC/usr/lib/python2.7/site-packages/ansible/plugins/connection/zone.pyt<module>	s$



Anon7 - 2022
AnonSec Team