%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddlZ	ddl
Z	ddljj
Z
ddlZ	ddlmZmZddlmZddlmZyddlZWnek
r�nXeje�ZeZy�ddlZejdkrHejej dd	d
gde�de!�dkr~e�q~n6ejej dd	d
g�de!�dkr~e�ne!ZWnaek
r�yddl#Ze!ZWq�ek
r�d
Z$e	jj%de$�ej&d�q�XnXer:e'ed�r:de(fd��YZ)de*fd��YZ+e+�e_+nd�Z,d�Z-d�Z.de*fd��YZ/de*fd��YZ0dS(u�
Many aspects of the salt payload need to be managed, from the return of
encrypted keys to general payload dynamics and packaging, these happen
in here
i(tabsolute_importtprint_functiontunicode_literalsN(tSaltReqTimeoutErrortSaltDeserializationError(tCaseInsensitiveDict(tsixiiiituse_bin_typetuse_listu[%(levelname)-8s] %(message)st
log_formatu7Unable to import msgpack or msgpack_pure python modulesu
exceptionstPackValueErrorcB@seZdZRS(uF
        older versions of msgpack do not have PackValueError
        (t__name__t
__module__t__doc__(((s0/usr/lib/python2.7/site-packages/salt/payload.pyR
?st
exceptionscB@seZdZe�ZRS(uL
        older versions of msgpack do not have an exceptions module
        (RRR
R
(((s0/usr/lib/python2.7/site-packages/salt/payload.pyRDscC@s
tj|�S(u�
    This method for now just wraps msgpack.dumps, but it is here so that
    we can make the serialization a custom option in the future with ease.
    (tmsgpacktdumps(tpayload((s0/usr/lib/python2.7/site-packages/salt/payload.pytpackageMscC@stj|dt�S(u
    Unpackages a payload
    R(RtloadstTrue(tpackage_((s0/usr/lib/python2.7/site-packages/salt/payload.pyt	unpackageUscK@sFi|d6}i}x|D]}||||<qW||d<t|�S(u�
    Pass in the required arguments for a payload, the enc type and the cmd,
    then a list of keyword args to generate the body of the load dict.
    uencuload(R(tenctkwargsRtloadtkey((s0/usr/lib/python2.7/site-packages/salt/payload.pytformat_payload\s


tSerialcB@sDeZdZd�Zded�Zd�Zed�Zd�Z	RS(ub
    Create a serialization object, this object manages all message
    serialization in Salt
    cC@sRt|t�r'|jdd�|_n't|tj�rE||_n	d|_dS(Nuserialumsgpack(t
isinstancetdicttgettserialRtstring_types(tselftopts((s0/usr/lib/python2.7/site-packages/salt/payload.pyt__init__ns
cC@s�zzyd�}tj�itd6|d6}tjdkr�tjdkrq|d
krdt|d<q{t|d<n
||d	<ytj||�}Wq�tk
r�|j	dd
�|j	d	d
�tj||�}q�Xntj||�}t
jr |d
kr |r tj
jj|�}nWnUtk
rx}tjd
|�tjd|�tj�t
jtd�|��nXWd
tj�X|S(u�
        Run the correct loads serialization format

        :param encoding: Useful for Python 3 support. If the msgpack data
                         was encoded using "use_bin_type=True", this will
                         differentiate between the 'bytes' type and the
                         'str' type by decoding contents with 'str' type
                         to what the encoding was set as. Recommended
                         encoding is 'utf-8' when using Python 3.
                         If the msgpack data was not encoded using
                         "use_bin_type=True", it will try to decode
                         all 'bytes' and 'str' data (the distinction has
                         been lost in this case) to what the encoding is
                         set as. In this case, it will fail if any of
                         the contents cannot be converted.
        cS@s8|dkr4tjjj|�}tjj|d�S|S(NiNu%Y%m%dT%H:%M:%S.%f(tsalttutilststringutilst
to_unicodetdatetimetstrptime(tcodetdata((s0/usr/lib/python2.7/site-packages/salt/payload.pytext_type_decoder�suuse_listuext_hookiiiiurawuencodingu�Could not deserialize msgpack message. This often happens when trying to read a file not in binary mode. To see message payload, enable debug logging and retry. Exception: %su.Msgpack deserialization failure on message: %su=Could not deserialize msgpack message. See log for more info.N(iii(iii(tgctdisableRRtversiontNonetFalseRtUnicodeDecodeErrortpopRtPY3R%t	transporttframetdecode_embedded_strst	Exceptiontlogtcriticaltdebugtcollectt
raise_fromRtenable(R"tmsgtencodingtrawR-tloads_kwargstrettexc((s0/usr/lib/python2.7/site-packages/salt/payload.pyRvsB	







cC@sL|j�}|j�|rHtjr8|j|dd�S|j|�SndS(u>
        Run the correct serialization to load a file
        RAuutf-8N(treadtcloseRR5R(R"tfn_R,((s0/usr/lib/python2.7/site-packages/salt/payload.pyR�s
	c@s�d�}y?tjdkr4tj|d|d|�Stj|d|�SWnsttjjfk
r��fd���|�}tjd	kr�tj|d|d|�Stj|d|�SnXdS(
u�
        Run the correct dumps serialization format

        :param use_bin_type: Useful for Python 3 support. Tells msgpack to
                             differentiate between 'str' and 'bytes' types
                             by encoding them differently.
                             Since this changes the wire protocol, this
                             option should not be used outside of IPC.
        cS@s�t|tj�rtj|�St|tjtjf�rbtjdtj	j
j|jd���St|t
j�r~t|�St|t
j�r�t|�St|tt
jf�r�t|�St|t�r�t|�S|S(NiNu%Y%m%dT%H:%M:%S.%f(RRt
integer_typest	text_typeR)tdateRtExtTypeR%R&R'tto_byteststrftimetimmutabletypest
ImmutableDictRt
ImmutableListtlisttsettImmutableSetttupleR(tobj((s0/usr/lib/python2.7/site-packages/salt/payload.pytext_type_encoder�s




iitdefaultRc@s�t|t�rOx3tj|j��D]\}}�|�||<q%Wt|�St|ttf�r�t|�}x*t|�D]\}}�|�||<q}W|St|tj�r�|t	dd�kr�tj
|�S|SdS(Nii@(RRRt	iteritemstcopyRRRUt	enumerateRItpowRJ(RVRtvaluetidxtentry(tverylong_encoder(s0/usr/lib/python2.7/site-packages/salt/payload.pyR`�s"
'
N(iii(iii(RR0Rt
OverflowErrorRR
(R"R@RRW((R`s0/usr/lib/python2.7/site-packages/salt/payload.pyR�s
	cC@sLtjr"|j|j|��n|j|j|dt��|j�dS(uG
        Serialize the correct data into the named file object
        RN(RtPY2twriteRRRG(R"R@RH((s0/usr/lib/python2.7/site-packages/salt/payload.pytdump
s	N(
RRR
R$R1R2RRRRd(((s0/usr/lib/python2.7/site-packages/salt/payload.pyRis	F	EtSREQcB@steZdZddddd�Zed��Zd�Zd�Zdd	d
�Z	dd	d�Z
d�Zd
�ZRS(uC
    Create a generic interface to wrap salt zeromq req calls.
    uumsgpackicC@sU||_||_t|�|_||_tj�|_tj�|_	||_
dS(N(tmastertid_RR tlingertzmqtContexttcontexttPollertpollerR#(R"RfRgR RhR#((s0/usr/lib/python2.7/site-packages/salt/payload.pyR$s			cC@st|d�s|jjtj�|_ttd�rO|jjtjd�n|j�|j	j
d�r�ttd�r�|jjtjd�q�ttd�r�|jjtjd�q�n|j
|j_
|jr�|jjtj|j�n|jj|j	�n|jS(	u+
        Lazily create the socket.
        u_socketuRECONNECT_IVL_MAXi�utcp://[uIPV6iuIPV4ONLYi(thasattrRktsocketRitREQt_sockett
setsockopttRECONNECT_IVL_MAXt_set_tcp_keepaliveRft
startswithtIPV6tIPV4ONLYRhRgtIDENTITYtconnect(R"((s0/usr/lib/python2.7/site-packages/salt/payload.pyRo(s 	
	cC@s�ttd�r�|jr�d|jkrG|jjtj|jd�nd|jkrv|jjtj|jd�nd|jkr�|jjtj|jd�nd|jkr�|jjtj|jd�q�ndS(Nu
TCP_KEEPALIVEu
tcp_keepaliveutcp_keepalive_idleutcp_keepalive_cntutcp_keepalive_intvl(	RnRiR#RqRrt
TCP_KEEPALIVEtTCP_KEEPALIVE_IDLEtTCP_KEEPALIVE_CNTtTCP_KEEPALIVE_INTVL(R"((s0/usr/lib/python2.7/site-packages/salt/payload.pyRtBs				cC@s�t|d�r�t|jjt�rpt|jjj��}xl|D]&}tjd|�|jj	|�qCWn;x8|jjD]*}tjd|�|jj	|d�q}W|`
ndS(u.
        delete socket if you have it
        u_socketuUnregistering socket: %siN(RnRRmtsocketsRRRtkeysR:ttracet
unregisterRq(R"R~Ro((s0/usr/lib/python2.7/site-packages/salt/payload.pytclear_socketUs
ii<c	C@si|d6}||d<|jj|�}|jj|�|jj|jtj�d}x�tr�|jj	|d�}|d7}|r�Pn|dkr�t
jd|||�n||kr[|j�t
dj|||���q[q[W|jj|jj��S(uO
        Takes two arguments, the encryption type and the base payload
        uenculoadii�iu5SaltReqTimeoutError: after %s seconds. (Try %s of %s)u5SaltReqTimeoutError: after {0} seconds, ran {1} tries(R RRotsendRmtregisterRitPOLLINRtpollR:tinfoR�RtformatRtrecv(	R"RRttriesttimeoutRtpkgttriedtpolled((s0/usr/lib/python2.7/site-packages/salt/payload.pyR�es*

	

cC@s:|jdd�}|jdi�}|j||||�S(uA
        Detect the encryption type based on the payload
        uencuclearuload(RR�(R"RR�R�RR((s0/usr/lib/python2.7/site-packages/salt/payload.pyt	send_auto�scC@sDt|jjt�r�t|jjj��}x�|D]E}|jtkri|jt	j
d�|j�n|jj|�q4Wnfxc|jjD]U}|djtkr�|djt	j
d�|dj�n|jj|d�q�W|j
jtkr|j
jt	j
d�|j
j�n|jjtkr@|jj�ndS(Nii(RRmR~RRRRtclosedR2RrRitLINGERRGR�RoRktterm(R"R~Ro((s0/usr/lib/python2.7/site-packages/salt/payload.pytdestroy�s"

cC@s|j�dS(N(R�(R"((s0/usr/lib/python2.7/site-packages/salt/payload.pyt__del__�sN(
RRR
R1R$tpropertyRoRtR�R�R�R�R�(((s0/usr/lib/python2.7/site-packages/salt/payload.pyRes				(iii(1R
t
__future__RRRtloggingR.R)tsalt.logR%tsalt.transport.frametsalt.utils.immutabletypesR&ROtsalt.utils.stringutilstsalt.exceptionsRRtsalt.utils.dataRtsalt.extRRitImportErrort	getLoggerRR:R2tHAS_MSGPACKRR0RRRR1tmsgpack_puret
LOG_FORMATtsetup_console_loggertfatalRnR9R
tobjectRRRRRRe(((s0/usr/lib/python2.7/site-packages/salt/payload.pyt<module>sT
3-	



			
�

Zerion Mini Shell 1.0