Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/module_utils/network/common/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyo

�
�Udac@s<ddlZddlZddlmZddlmZmZddlmZddddd	gZ	e
ejd
�ejd�ejd�g�Zy
ej
ZWnek
r�ejZnXd
efd��YZed�Zd�Zd�Zed�Zded�Zdefd��YZdefd��YZdS(i����N(tzip(tto_bytest	to_native(tto_listt#t!s/*s*/techosUsing \d+ out of \d+ bytessBuilding configurations!Current configuration : \d+ bytest
ConfigLinecBs�eZd�Zd�Zd�Zd�Zd�Zed��Zed��Z	ed��Z
ed��Zed	��Zed
��Z
ed��Zd�ZRS(
cCs:t|�j�|_||_t�|_t�|_dS(N(tstrtstripttexttrawtlistt	_childrent_parents(tselfR((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyt__init__4s	cCs|jS(N(R(R((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyt__str__:scCs|j|jkS(N(tline(Rtother((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyt__eq__=scCs|j|�S(N(R(RR((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyt__ne__@scCs7x$|jD]}|j|kr
|Sq
Wt|��dS(N(R
R
tKeyError(Rtkeytitem((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyt__getitem__CscCs&|j}|j|j�dj|�S(Nt (tparentstappendR
tjoin(RR((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyRIs	cCs
t|j�S(N(t_obj_to_textR
(R((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pytchildrenOscCs|jS(N(R
(R((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyt
child_objsSscCs
t|j�S(N(RR(R((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyRWscCs,t|j�}|j|j�dj|�S(Ns
(t_obj_to_rawRRRR(Rtconfig((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pytpath[scCst|j�dkS(Ni(tlenR
(R((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pythas_childrenascCst|j�dkS(Ni(R$R(R((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pythas_parentsescCs2t|t�std��n|jj|�dS(Ns"child must be of type `ConfigLine`(t
isinstanceRtAssertionErrorR
R(Rtobj((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyt	add_childis(t__name__t
__module__RRRRRtpropertyRRR RR#R%R&R*(((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyR2s					cCsRx'|ptD]}|j|�r
tSq
Wx!tD]}|j|�r1tSq1WdS(N(tDEFAULT_COMMENT_TOKENSt
startswithtTruetDEFAULT_IGNORE_LINES_REtmatch(R
ttokensRtregex((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pytignore_lineos
cCsg|D]}|j^qS(N(R
(txto((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyRxscCsg|D]}|j^qS(N(R(R6R7((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyR!|scCspt�}xZ|D]R}||kr|j|�x0|jD]"}||kr9|j|�q9q9WqqWt|�S(N(RRR
R!(tobjectstvisitedtitemsR7tchild((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyt
_obj_to_block�s	

tblockcCs|dkrt|�}nB|dkr6t|�}n'|dkrQt|�}ntd��|dkr|r�xpt|�D]b\}}|d}|t|�kr�|jd�r�||jd�r�d|}n|||<q|W|jd�n|jd	�nd
j|�S(NR=tcommandsRs)unknown value supplied for keyword outputiRs!
%sRtends
(	R<RR!t	TypeErrort	enumerateR$R/RR(R8toutputtcommentsR:tindexRtnextitem((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pytdumps�s"
5
t
NetworkConfigcBs�eZdddd�Zed��Zed��Zed��Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
dd�Zd�Zd
�Zd�Zdd�Zd�Zd�Zd�Zdddd�Zdd�ZRS(icCs�||_t�|_d|_|rfx?|D]4}t|t�sRtj|�}nt	j
|�q+Wn|r||j|�ndS(N(t_indentRt_itemstNonet_config_textR'tPatterntretcompileR1taddtload(Rtindenttcontentstignore_linesR((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyR�s		
cCs|jS(N(RI(R((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyR:�scCs|jS(N(RK(R((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pytconfig_text�scCs5tj�}|jtt|�dd��|j�S(Nterrorstsurrogate_or_strict(thashlibtsha1tupdateRRtdigest(RRX((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyRX�scCs4x!|D]}|j|kr|SqWt|��dS(N(R
R(RRR((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyR�s
cCs
t|j�S(N(titerRI(R((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyt__iter__�scCs&djg|jD]}|j^q�S(Ns
(RR:R(Rtc((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyR�scCs
t|j�S(N(R$RI(R((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyt__len__�scCs||_|j|�|_dS(N(RKtparseRI(Rts((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyRP�s	cCs,t|��}|j|j��SWdQXdS(N(topenRPtread(Rtfptf((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pytloadfp�scCs�tjd�}tjd�}tjd�}t�}t�}dg}x�tt|dd�jd��D]�\}	}
|jd|
�j�}t|
�}|sjt	||�r�qjn|j
|
�r�|g}dg}n|j
|
�}
|
jd	�}||d
kr,x!|d
|kr(|j�qWn||d
krL|j
|�nt|�d	}|d	}|| |_|t|�kr�|j
|�qjnx't|t|��D]}|j�q�W|j
|�||j|�|j
|�qjW|S(Ns\Ss	^\s*(.+)$s([{};])iRURVs
tii����(RMRNRRARtsplittsubR	RR5R2tstarttpopRR$RtrangeR*(Rtlinestcomment_tokensttoplevelt	childlinet	entry_regt	ancestorsR"tindentstlinenumRR
tcfgR2tline_indenttcurleveltparent_levelti((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyR_�sB			.	



cCsEx>|jD]3}|j|dkr
|j|d kr=|Sq
q
WdS(Ni����(R:R
R(RR#R((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyt
get_object
scCsOt|t�std��n|j|�}|sBtd��n|j|�S(Ns#path argument must be a list objectspath does not exist in config(R'RR(Ryt
ValueErrort
_expand_block(RR#R)((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyt	get_blockscCs|j|�}t|d�S(NR=(R|RF(RR#R=((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pytget_block_configscCs_|dkrt�}n|j|�x3|jD](}||krGq/n|j||�q/W|S(N(RJRRR
R{(Rt	configobjtSR;((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyR{s
cCs=t�}x-|jD]"}||kr|j|�qqW|S(N(RR:R(RRtupdatesR((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyt
_diff_line)s
	c	Cs�t�}|rst|t�rst|�dkrs|d}|jrsx*|jD]}|jdt|��qMWqsnx�t|j�D]o\}}y<t|�j	�t||�j	�kr�|j
|�nWq�ttfk
r�|j
|�q�Xq�W|S(Ni(
RR'R$RtinsertRRAR:RR	RtAttributeErrort
IndexError(RRR�tstart_othertparentRDR((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyt_diff_strict0s	'
	 (cCs~t�}t|�t|j�kr7|j|j�nCx@t|j|�D],\}}||krJ|j|j�PqJqJW|S(N(RR$R:textendR(RRR�toursttheirs((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyt_diff_exactBs	RcCs�|rE|dkrEy|j|�}WqNtk
rAt�}qNXn	|j}t|d|�}||�}|dkrt�}xW|D]O}|js�|j|�q�x-|jD]"}	|	|kr�|j|	�q�q�Wq�Wt�}x'|D]}|j|j	|��q�Wnt
�}
t�}xn|D]f}x@|jD]5}	|	j|
kr8|
j|	j�|j|	�q8q8W|j|�|
j|j�q(W|S(s�Perform a config diff against the another network config

        :param other: instance of NetworkConfig to diff against
        :param match: type of diff to perform.  valid values are 'line',
            'strict', 'exact'
        :param path: context in the network config to filter the diff
        :param replace: the method used to generate the replacement lines.
            valid values are 'block', 'line'

        :returns: a string of lines that are different
        Rs_diff_%sR=(
R|RzRR:tgetattrR&RRR�R{tsetRRO(RRR2R#treplacetmethR�RRtpR9texpanded((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyt
differenceMs:
		
		
		

cCst�}d}d}|sxx�|D]O}t|�r:q"nt|�}||_||jkr"|jj|�q"q"Wn�x�t|�D]�\}}	y2|d}
|j||
 �d}|j|�Wq�t	k
rT||j
}t|	�}|	jt|	�|�|_|r4t|�|_
|djj|�n|jj|�|j|�q�Xq�Wx�|D]�}t|�rxq`nx�|djD]}|j|kr�Pq�q�Wt|�|j
}t|�}|jt|�|�|_||_
|djj|�|jj|�q`WdS(Niii����(RRJR5RRR:RRAR|RzRHtrjustR$RR
R
(RRlRRqtoffsetR)RRRDR�RxR;((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyRO�sJ	
	



	N(R+R,RJRR-R:RTRXRR\RR^RPReR_RyR|R}R{R�R�R�R�RO(((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyRG�s(						6			
			3tCustomNetworkConfigcBs8eZd�Zdd�Zd�Zd�Zd�ZRS(cCsg|jD]}|j^q
S(N(R:R
(RR((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyt
items_text�scCs_|dkrt�}n|j|�x3|jD](}||krGq/n|j||�q/W|S(N(RJRRR texpand_section(RR~RR;((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyR��s
cCs#djg|D]}|j^q
�S(Ns
(RR(RtsectionR((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pytto_block�scCs<y |j|�}|j|�SWntk
r7t�SXdS(N(tget_section_objectsR�RzR(RR#R�((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pytget_section�s

cCsLt|t�s|g}n|j|�}|s?td��n|j|�S(Nspath does not exist in config(R'RRyRzR�(RR#R)((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyR��sN(R+R,R�RJR�R�R�R�(((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyR��s
	
		(RMRWtansible.module_utils.six.movesRtansible.module_utils._textRRt)ansible.module_utils.network.common.utilsRR.R�RNR1t
_pattern_typeRLR�tobjectRRJR5RR!R<tFalseRFRGR�(((sN/usr/lib/python2.7/site-packages/ansible/module_utils/network/common/config.pyt<module>s,


=			�

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]