%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/cli/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/cli/cp.pyc

�
���^c@@s:dZddlmZmZmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddl
ZddlZddlZddlZddlZddlZddlZddlZddlZddlmZeje�Zdejjjfd��YZdefd��YZ dS(	u�
The cp module is used to execute the logic used by the salt-cp command
line application, salt-cp is NOT intended to broadcast large files, it is
intended to handle text files.
Salt-cp can be used to distribute configuration files
i(tabsolute_importtprint_functiontunicode_literalsN(tsixt	SaltCPClicB@seZdZd�ZRS(u-
    Run the salt-cp command line client
    cC@sG|j�|j�tjjj|j�t|j�}|j�dS(u!
        Execute salt-cp
        N(	t
parse_argstsetup_logfile_loggertsalttutilstverifyt
verify_logtconfigtSaltCPtrun(tselftcp_((s//usr/lib/python2.7/site-packages/salt/cli/cp.pyR
)s


(t__name__t
__module__t__doc__R
(((s//usr/lib/python2.7/site-packages/salt/cli/cp.pyR$sRcB@s_eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
uL
    Create a salt cp object, used to distribute simple files with salt
    cC@s"||_tjjj�|_dS(N(toptsRRtplatformt
is_windows(RR((s//usr/lib/python2.7/site-packages/salt/cli/cp.pyt__init__;s	cC@sV|jr
dSy'tttj|�j�dd�SWnttt	fk
rQdSXdS(Ni����i(
RtNonetinttocttoststattst_modet	TypeErrort
IndexErrort
ValueError(Rtpath((s//usr/lib/python2.7/site-packages/salt/cli/cp.pyt_mode?s	'c	C@si}g}ytj|�}Wntk
r�}|jtjkrltjjdj|��tj	d�q|jtj
tjfkr|j|�||<qnfX|s�|j
|�nxL|D]D}|jtjj||��\}}|j|�|j|�q�W||fS(u3
        Get a list of all specified files
        u{0} does not exist
i*(RtlistdirtOSErrorterrnotENOENTtsyststderrtwritetformattexittEINVALtENOTDIRR!tappendt_recurseR tjointupdatetextend(	RR tfilest
empty_dirst	sub_pathstexctfn_tfiles_tempty_dirs_((s//usr/lib/python2.7/site-packages/salt/cli/cp.pyR.Gs"
$
cC@sfi}t�}xD|jdD]5}|j|�\}}|j|�|j|�qW|t|�fS(Nusrc(tsetRR.R0tsorted(RR2R3R6R7R8((s//usr/lib/python2.7/site-packages/salt/cli/cp.pyt_list_filesas	
cC@s}tjj|�sEdj|�}tjj|d�tjd�ntj	j
j|d��}|j�}WdQXi||6S(uM
        Take a path and return the contents of the file as a string
        u*The referenced file, {0} is not available.u
i*urN(
RR tisfileR)R&R'R(R*RRR2tfopentread(RR6terrtfp_tdata((s//usr/lib/python2.7/site-packages/salt/cli/cp.pyt
_file_dictjscC@s�i}xy|jdD]j}tjj|�rE|j|j|��qtjj|�rtjj	j
|d�tjd�qqW|S(us
        Parse the files indicated in opts['src'] and load them into a python
        object for transport
        usrcue is a directory, only files are supported in non-chunked mode. Use "--chunked" command line argument.i(
RRR R<R0RBtisdirRRtstringutilst	print_cliR&R*(RR2R6((s//usr/lib/python2.7/site-packages/salt/cli/cp.pyt_load_filesvscC@sT|jdr|j�}n|j�}tjj||jjdd�|j�dS(u+
        Make the salt client call
        uchunkeduoutputunestedN(Rtrun_chunkedtrun_oldstyleRtoutputtdisplay_outputtget(Rtret((s//usr/lib/python2.7/site-packages/salt/cli/cp.pyR
�s
	cC@s�|j�|jdg}tjj|jd�}|jdd||jdg}|jjdd�}|dk	r�|j|�n|j|�S(uO
        Make the salt client call in old-style all-in-one call method
        udestu	conf_fileutgtucp.recvutimeoutuselected_target_optionN(	RFRRtclienttget_local_clientRKRR-tcmd(Rtargtlocaltargstselected_target_option((s//usr/lib/python2.7/site-packages/salt/cli/cp.pyRH�s
c
@s��j�\}}�jd��jd}�jd}�jd}�jjd�}t|�p�t|�dkp�ttjd����|r�tjj	j
ntjjj}tjj
j�j�j|d|p�d	�}|d
}	tjj�jd�}
����fd�}i}d
tj�xtj|�D]�\}
}||
�}d}i}x�||
d�jd�D]�}tjtjjj|��}|dk}tjd|
|r�dj|�nd|||r�dj|�nd�|d|||||g|g}|dk	r.|j|�n|
j|�}|s�dj|dkr[dnd�jd�}x$|	D]}||j |i�|<quWPnxXtj|�D]G\}}||j |i�|<|t!k	r�||kr�|||<q�q�W|d7}q{Wx+tj|�D]\}}||||<qWq=Wx�|D]�}||�}tjd||rndj|�nd|�|d|dg|g}|dk	r�|j|�nx<tj|
j|��D]"\}}||j |i�|<q�Wq;W|S(uT
        Make the salt client call in the new fasion chunked multi-call way
        udestugziputgtutimeoutuselected_target_optioniu[\\/]$ttgt_typeuglobuminionsu	conf_filec@s�|�jdkr<�r8tjj�tjj|��S�Sxy�jdD]V}tjj||tj�}|j��r�qJntjj�tjj|�|�SWtj	d|�dSdS(Nusrcu!Failed to find remote path for %s(RRR R/tbasenametrelpathtsept
startswithtlogterrorR(R6R RV(tdesttdest_is_dirtparentR(s//usr/lib/python2.7/site-packages/salt/cli/cp.pyt_get_remote_path�s%#u..t
chunk_sizeusalt_cp_chunk_sizeu#Copying %s to %starget '%s' as %s%su{0} uu
 (chunk #{0})ucp.recv_chunkeduZPublish failed.{0} It may be necessary to decrease salt_cp_chunk_size (current value: {1})u File partially transferred.u&Creating empty dir %s on %starget '%s'N("R;RRKtbooltlentretsearchRRt	gzip_utilt
compress_filet	itertoolst	read_filetminionst	CkMinionst
check_minionsRMRNRRWRt	iteritemstbase64t	b64encodeRDtto_bytesRYtdebugR)RR-ROt
setdefaulttTrue(RR2R3tgzipttgtttimeoutRStreadert_resRhRQR^RLR6tmodetremote_pathtindextfailedtchunkR-RRtresulttmsgtminiont	minion_idt
minion_rettdirname((R[R\R]Rs//usr/lib/python2.7/site-packages/salt/cli/cp.pyRG�s�





 	

%(RRRRR!R.R;RBRFR
RHRG(((s//usr/lib/python2.7/site-packages/salt/cli/cp.pyR7s									(!Rt
__future__RRRRlR$tloggingRRbR&tsalt.clientRtsalt.outputtsalt.utils.filestsalt.utils.gzip_utiltsalt.utils.itertoolstsalt.utils.minionstsalt.utils.parserstsalt.utils.platformtsalt.utils.stringutilstsalt.utils.verifytsalt.extRt	getLoggerRRYRtparserstSaltCPOptionParserRtobjectR(((s//usr/lib/python2.7/site-packages/salt/cli/cp.pyt<module>s*

Zerion Mini Shell 1.0