Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/module_utils/network/aci/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyc

�
�Udac@s1ddlZddlZddlZddlmZddlmZddlmZddl	m
Z
mZy&ddlm
Z
mZmZeZWnek
r�eZnXyddlZeZWnek
r�eZnXyddlmZeZWnek
r
eZnXd�Zd	efd
��YZdS(i����N(tdeepcopy(tboolean(t	fetch_url(tto_bytest	to_native(tFILETYPE_PEMtload_privatekeytsign(tcobracCstdtdddtddg�dtdddt�d	tddd
dddg�d
tdddt�dtddddgdt�dtddddg�dtddd
dddddg�dtddd
d�dtddd
t�dtddd
t�dtddd
t��S(Nthostttypetstrtrequiredtaliasesthostnametporttinttusernametdefaulttadmintusertpasswordtno_logtprivate_keytcert_keytcertificate_namet	cert_nametoutput_leveltnormaltchoicestdebugtinfottimeoutit	use_proxytbooltuse_ssltvalidate_certs(tdicttTruetFalse(((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pytaci_argument_specBs$t	ACIModulecBsgeZd�Zddd�Zd�Zd�Zd�Zd�Zd$dd$d	�Z	d
�Z
d�Zd�Zd$d
�Z
d�Zd$d�Zd�Zd�Zd�Zd�Zd$d$d�Zd$d$d$d$d�Zd�Zd�Zd�Zd�Zd�Zd�Zed��Zd�Zd�Zed��Z d$d �Z!d!�Z"d"�Z#d#�Z$RS(%cCs�||_|j|_tdt�|_t�|_t�|_tdddd�|_	d|_
t�|_d|_t�|_
d|_d|_d|_d|_d|_d|_d|_d|_|j�|jjr�|jjd�d|jd<n|jdrQts(|jjd	d
�q~|jddk	r~|jjd�q~n-|jdrk|j�n|jjd	d
�dS(Ntchangedtcodettextts2Enable debug output because ANSIBLE_DEBUG was set.RRRtmsgsLCannot use signature-based authentication because pyopenssl is not availableRs^When doing ACI signatured-based authentication, providing parameter 'password' is not requiredsKEither parameter 'password' or 'private_key' is required for authentication(tmoduletparamsR%R'tresulttheaderstsett
child_classestNoneterrortexistingtconfigtoriginaltproposedt
filter_stringtmethodtpathtresponsetstatusturltimdatat
totalCounttdefine_protocolt_debugtwarntHAS_OPENSSLt	fail_jsontlogin(tselfR/((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyt__init__Ts<											



tyestnocCsG|dkrdS|tkr |S|tkr0|S|jjdd�dS(s! Return an acceptable value back R.s3Boolean value '%s' is an invalid ACI boolean value.N(R5R&R'R/RG(RItvaluettruetfalse((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyR�scCsdy|jdd�SWnItk
r_|jd�}d|jd�|jd|d |dfSXdS(	sP Return an ACI-compatible ISO8601 formatted time: 2123-12-12T00:00:00.000+00:00 ttimespectmillisecondss%zs%s.%03d%s:%ss%Y-%m-%dT%H:%M:%Si�iN(t	isoformatt	Exceptiontstrftimetmicrosecond(RItdtttz((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pytiso8601_format�s

cCs,|jjdt�rdnd|jd<dS(s) Set protocol based on use_ssl parameter R#thttpsthttptprotocolN(R0tgetR&(RI((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyRC�scCs7tdddddd�}||jd|jd<d	S(
s% Set method based on state parameter tabsenttdeletetpresenttposttqueryR\tstateR<N(R%R0(RIt	state_map((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyt
define_method�sc
CsOd|jkr2|jddk	r2d|j}n
d|j}iii|jdd6|jdd6d6d	6}t|j|d
tj|�ddd
|jd
d|jd�\}}|ddkr7|d|_|d|_y,|j|d�|j	dd|j
�Wq7tk
r3|j	dd|�q7Xn|jd|jd<dS(s Log in to APIC Rs2%(protocol)s://%(host)s:%(port)s/api/aaaLogin.jsons)%(protocol)s://%(host)s/api/aaaLogin.jsonRtnameRtpwdt
attributestaaaUsertdataR<tPOSTR R!R?i�R.tbodys(Authentication failed: %(code)s %(text)ss&Connection failed for %(url)s. %(msg)ss
Set-CookietCookieN(
R0R5RR/tjsontdumpsR>R?t
response_jsonRGR6tKeyErrorR2(RIR@tpayloadtresptauth((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyRH�s$"
0



R-c
Cs�|dkr"|jdj�}n|dkr:|j}nd|jd�}|dkrbd}n|jdjd�r�ytt|jd�}Wn$tk
r�|j	j
dd�nX|jddkr�|jd	|jd<q�n�|jdjd
�r|j	j
dd�n{tjj|jd�sA|j	j
dd�ny/t
|jdd
��}|j�}WdQXWn/tk
r�|j	j
dd|jd�nX|jd�r?ytt|�}Wn/tk
r�|j	j
dd|jd�nX|jddkr�tjjtjj|jd�d�|jd<q�nN|jd
�ro|j	j
dd|jd�n|j	j
dd|jd�|||}tjt||d��}d|jd	|jdf}	dd|	ddt|�|jd<dS(sf Perform APIC signature-based authentication, not the expected SSL client certificate authentication. R<t/R-Rs-----BEGIN PRIVATE KEY-----R.s-Cannot load provided 'private_key' parameter.RRs-----BEGIN CERTIFICATE-----sSProvided 'private_key' parameter value appears to be a certificate. Please correct.sIThe provided private key file does not appear to exist. Is it a filename?trNs"Cannot open private key file '%s'.s"Cannot load private key file '%s'.isIProvided private key file %s appears to be a certificate. Please correct.sSProvided private key file '%s' does not appear to be a private key. Please correct.tsha256suni/userext/user-%s/usercert-%ss!APIC-Certificate-Algorithm=v1.0; sAPIC-Certificate-DN=%s; s*APIC-Certificate-Fingerprint=fingerprint; sAPIC-Request-Signature=%sRl(R5R0tupperR=tlstript
startswithRRRSR/RGtostexiststopentreadtbasenametsplitexttbase64t	b64encodeRRR2(
RIR=RqR<tsig_keytfhtprivate_key_contenttsig_requestt
sig_signaturetsig_dn((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyt	cert_auth�sL	

"
"6!cCs�ytj|�}Wn=tk
rR}tdddd|�|_||jd<dSXy|d|_Wntk
r�t�|_nXt|d�|_	|j
�dS(	s" Handle APIC JSON response output R+i����R,s4Unable to parse output as JSON, see 'raw' output. %strawNRARB(RmtloadsRSR%R6R1RARpRRBtresponse_error(RIt	rawoutputtjsondatate((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyRo�s

cCs�y+tjjt|��}tj|�}Wn=tk
rj}tdddd|�|_||j	d<dSXy|dd|_
Wntk
r�t�|_
nXt|dd	d
�|_
|j�dS(s! Handle APIC XML response output R+i����R,s3Unable to parse output as XML, see 'raw' output. %sR�NRAtchildrenRgRB(tlxmltetreet
fromstringRRRiRSR%R6R1RARpRRBR�(RIR�txmltxmldataR�((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pytresponse_xmls

cCsL|jdkrHy|jddd|_WqHttfk
rDqHXndS(s" Set error information when found t0iR6RgN(RBRAR6Rpt
IndexError(RI((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyR�*s
cCs�|j�||_d|jkrU|jddk	rUd|j|jd�|_nd|j|jd�|_|jdr�|jd|d|�nt|j|jd|d	|j	d
|jd
j
�d|jdd|jd�\}}|d
|_|d|_|ddkrpy,|j
|d�|jd
d|j�Wqptk
rl|jd
d|�qpXn|j
|j��dS(s Perform a REST request Rs!%(protocol)s://%(host)s:%(port)s/Rts%(protocol)s://%(host)s/RR=RqRiR2R<R R!R.R?i�RksAPIC Error %(code)s: %(text)ss&Connection failed for %(url)s. %(msg)sN(RdR=R0R5RxR@R�RR/R2RwR>R?RoRGR6RpR}(RIR=RqRrR((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pytrequest4s,
	" 
	



cCs�||_d|jkrK|jddk	rKd|j|jd�|_nd|j|jd�|_|jdr�|jd|dd�nt|j|jd	dd
|jddd|jdd|jd�\}}|d
dkrY|d|_	|d
|_
y,|j|d�|jdd|j
�WqYtk
rU|jdd|�qYXntj|j��}tj|ddtdd�dS(s! Perform a query with no payload Rs!%(protocol)s://%(host)s:%(port)s/Rts%(protocol)s://%(host)s/RR=R<tGETRiR2R R!R?i�R.RksAPIC Error %(code)s: %(text)ss&Connection failed for %(url)s. %(msg)sRAt	sort_keystindentis
N(R=R0R5RxR@R�RR/R2R>R?RoRGR6RpRmR�R}RnR&(RIR=RrRa((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyRa[s,	" 
	



cCs�t�|jd<|j|�|jdd<|j|d|�|j|�|jdd<|jdd|jddkr�t|jd<ndS(s3 Perform a request, including a proper diff output tdifftbeforeRqtafterR*N(R%R1RaR�R&(RIR=Rq((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pytrequest_diff�s"cCs�td�|j�D��}|r�|jr=|jd7_n	d|_|jdjg|j�D]\}}d||f^q`�7_ndS(s. Append key-value pairs to self.filter_string css-|]#\}}|dk	r||fVqdS(N(R5(t.0tktv((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pys	<genexpr>�st&t?s%s=%sN(R%titemsR;tjoin(RIR0taccepted_paramsR�R�((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyt	update_qs�s		cs�td�|j�D��}t|�dkrQdj�fd�|j�D��St|�dkr�ddjg|j�D]!\}}dj�||�^qy�dSdS(	s= Build an APIC filter based on obj_class and key-value pairs css-|]#\}}|dk	r||fVqdS(N(R5(R�R�R�((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pys	<genexpr>�sit,c3s*|] \}}dj�||�VqdS(seq({0}.{1},"{2}")N(tformat(R�R�R�(t	obj_class(sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pys	<genexpr>�ssand(seq({0}.{1},"{2}")t)N(R%R�tlenR�R�(RIR�R0R�R�R�((R�sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pytbuild_filter�s
#c
Cs�|d}|d}|d}|d}|d}|d}|d}|d}	|jjd	dkr�|dk	r�dj|�|_|jid
d6�n�|dk	r�dj|�|_ndj|�|_|	r�|ji|j||�d6�n|r |ji|j||�d6�nd|jkrf|jddk	rfdjd|j|jj�|_n!djd|j|jj�|_|jr�|jidd6dj	t
|j��d6�ndS(Nttarget_classt
target_filtert
subtree_classtsubtree_filtert	object_rnt
module_objecttadd_subtree_filtertadd_target_filterRbR]R_sapi/mo/uni/{0}.jsonsconfig-onlysrsp-prop-includesapi/class/{0}.jsonsquery-target-filtersrsp-subtree-filterRs!{protocol}://{host}:{port}/{path}R=s{protocol}://{host}/{path}tfullsrsp-subtreeR�srsp-subtree-class(sabsentspresent(R/R0R5R�R=R�R�R@R4R�tsorted(
RItobjR�R�R�R�R�tmoR�R�((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyt_deep_url_path_builder�s8







""			cCs)x"|D]}|d|kr|SqWdS(Nt	aci_class(R5(RItparent_objectstparent_classt
parent_object((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyt_deep_url_parent_object�s
cCs�d|_d}d}t}t}t}t}	t}
t}|dkrTt�|_nt|�|_|d}|d}
|d}|d}|d}td|
d|d|
d	|d|�}|dk	r�|}nt}t}	|dk	r{|}t}t}t}d}t�}xt|d
kr�|jd|d|�}|dk	r&|d}|d}|d}|d}|d}|r�t}nt}t}|d
kr�|j|�n|dk	r�|dk	r�dj	||�}n|}||d<||d<t}n!d}|}t}|rt}n|}nt
d
j	|���|
ra|ra||	k	r}t}
q}n|r}||k	r}t}nt}qW|r�|r�|dk	r�t}q{|r�|dk	r�t}|jj|
�|rxt}qxq{|r|r|dkr|jj|
�|jj|�q{|rL|rL|dkrL|jj|
�q{|r{|r{|dkr{|jj|
�q{n||d<||d<||d<|j|�dS(s�
        This method is used to retrieve the appropriate URL path and filter_string to make the request to the APIC.

        :param target_object: The target class dictionary containing parent_class, aci_class, aci_rn, target_filter, and module_object keys.
        :param parent_objects: The parent class list of dictionaries containing parent_class, aci_class, aci_rn, target_filter, and module_object keys.
        :param child_classes: The list of child classes that the module supports along with the object.
        :type target_object: dict
        :type parent_objects: list[dict]
        :type child_classes: list[string]
        :return: The path and filter_string needed to build the full URL.
        R-R�R�taci_rnR�R�R�R�R�tuniR�s{0}/{1}sWReference error for parent_class '{0}'. Each parent_class must reference a valid objectR�R�R�N(
R;R5R'R3R4R%R&R�taddR�t
ValueErrortupdateR�(RIt
target_objectR�R4t
rn_buildertsubtree_classesR�R�thas_target_querythas_target_query_comparethas_target_query_differencethas_target_query_calledttarget_parent_classR�t	target_rnR�ttarget_module_objectturl_path_objecttcurrent_parent_classthas_parent_query_comparethas_parent_query_differencetis_first_parenttis_single_parenttsearch_classesR�tparent_parent_classR�t	parent_rnt
parent_filtertparent_module_object((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pytconstruct_deep_url�s�
	




				




		

				
	


cCsJd|_|d
kr$t�|_nt|�|_|d
k	rX|j||||�nN|d
k	rz|j|||�n,|d
k	r�|j||�n
|j|�d|jkr�|jdd
k	r�dj	d|j
|jj�|_n!dj	d|j
|jj�|_|jrF|j
idd6djt|j��d	6�nd
S(s�
        This method is used to retrieve the appropriate URL path and filter_string to make the request to the APIC.

        :param root_class: The top-level class dictionary containing aci_class, aci_rn, target_filter, and module_object keys.
        :param sublass_1: The second-level class dictionary containing aci_class, aci_rn, target_filter, and module_object keys.
        :param sublass_2: The third-level class dictionary containing aci_class, aci_rn, target_filter, and module_object keys.
        :param sublass_3: The fourth-level class dictionary containing aci_class, aci_rn, target_filter, and module_object keys.
        :param child_classes: The list of child classes that the module supports along with the object.
        :type root_class: dict
        :type subclass_1: dict
        :type subclass_2: dict
        :type subclass_3: dict
        :type child_classes: list
        :return: The path and filter_string needed to build the full URL.
        R-Rs!{protocol}://{host}:{port}/{path}R=s{protocol}://{host}/{path}R�srsp-subtreeR�srsp-subtree-classN(R;R5R3R4t_construct_url_4t_construct_url_3t_construct_url_2t_construct_url_1R0R�R=R/R@R�R�R�(RIt
root_classt
subclass_1t
subclass_2t
subclass_3R4((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyt
construct_urlWs 	
"$!	cCs�|d}|d}|d}|d}|jjddkrgdj|�|_|jid	d
6�nS|d
kr�dj|�|_|ji|j||�d6�ndj|�|_d
S(s^
        This method is used by construct_url when the object is the top-level class.
        R�R�R�R�RbR]R_sapi/mo/uni/{0}.jsonsconfig-onlysrsp-prop-includesapi/class/{0}.jsonsquery-target-filterN(sabsentspresent(R/R0R�R=R�R5R�(RIR�R�tobj_rnt
obj_filterR�((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyR��s



#cCsj|d}|d}|d}|d}|d}|d}|d}	|d}
|jjddkr�dj||�|_|jid	d
6�n�|dkr�|
dkr�dj|�|_|ji|j||	�d6�n�|dkr dj|�|_|ji|j||	�d6�nF|
dkrQ|jj|�d
j|�|_ndj||�|_dS(sa
        This method is used by construct_url when the object is the second-level class.
        R�R�R�R�RbR]R_sapi/mo/uni/{0}/{1}.jsonsconfig-onlysrsp-prop-includesapi/class/{0}.jsonsquery-target-filtersapi/mo/uni/{0}.jsonN(sabsentspresent(	R/R0R�R=R�R5R�R4R�(RItparentR�R�R�R�t
parent_objR�R�R�R�((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyR��s*







##c
Cs|d}|d}|d}|d}|d}|d}	|d}
|d}|d}|d}
|d}|d}|jjddkr�dj||	|
�|_|jid	d
6�nT|dkr|dkr|dkrdj|�|_|ji|j||�d6�n�|dkrc|dkrcdj|�|_|ji|j||�d6�n�|dkr�|dkr�|jj|�dj|�|_|ji|j||
�d6�nQ|dkr|dkr|jj	||g�d
j|�|_n|dkrt|jj|�dj|�|_|ji|j||
�d6�|ji|j||�d6�n�|dkr�|jj|�d
j|�|_|ji|j||�d6�nL|dkr�|jj|�dj||	�|_ndj||	|
�|_dS(s`
        This method is used by construct_url when the object is the third-level class.
        R�R�R�R�RbR]R_sapi/mo/uni/{0}/{1}/{2}.jsonsconfig-onlysrsp-prop-includesapi/class/{0}.jsonsquery-target-filtersapi/mo/uni/{0}.jsonsrsp-subtree-filtersapi/mo/uni/{0}/{1}.jsonN(sabsentspresent(
R/R0R�R=R�R5R�R4R�R�(RItrootR�R�R�troot_rntroot_filtertroot_objR�R�R�R�R�R�R�R�((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyR��sR











$### ##cCsR|d}|d}|d}|d}|d}	|d}
|d}|d}|d}
|d}|d}|d}|d}|d}|d}|d}|jdkr�|g|_n|jjddkrdj||
||�|_|jid	d
6�nH|dkrW|jj|�dj|�|_|ji|j||�d6�n�|dkr�|jj|�d
j|�|_|ji|j||�d6�n�|dkr�|jj|�dj||
�|_|ji|j||�d6�nR|dkr3|jj|�dj||
|�|_ndj||
||�|_dS(sa
        This method is used by construct_url when the object is the fourth-level class.
        R�R�R�R�RbR]R_sapi/mo/uni/{0}/{1}/{2}/{3}.jsonsconfig-onlysrsp-prop-includesapi/class/{0}.jsonsquery-target-filtersapi/mo/uni/{0}.jsonsrsp-subtree-filtersapi/mo/uni/{0}/{1}.jsonsapi/mo/uni/{0}/{1}/{2}.jsonN(sabsentspresent(	R4R5R/R0R�R=R�R�R�(RIR�tsecR�R�R�R�R�R�t	sec_classtsec_rnt
sec_filtertsec_objR�R�R�R�R�R�R�R�((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyR��sJ















###cCsPt�|_|jsdS|jjs6|jdrE|jdd�nt|j|jd|j	ddd|jdd|jd�\}}|d|_
|d	|_d|_|d	d
kr�t
|jd<|j|j��qLy,|j|d�|jdd
|j�WqLtk
r2|jdd|�qLXnt
|jd<d|_dS(s�
        This method is used to handle the logic when the modules state is equal to absent. The method only pushes a change if
        the object exists, and if check_mode is False. A successful change will mark the module as changed.
        NRR<tDELETER2R R!R.R?i�R*RksAPIC Error %(code)s: %(text)ss&Connection failed for %(url)s. %(msg)s(R%R:R7R/t
check_modeR0R�RR@R2R>R?R<R&R1RoR}RGR6Rp(RIRrR((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyt
delete_config0s0	
	


	


c	Cs
|j|d}|jr�|jd|d}i}xB|j�D]4\}}|j|�}||krB|||<qBqBW|r�ii|d6|6}n|j|�}|r�|r�||ji|d6�q�|r�iiid6|d6|6}q�n	|j}||_dS(s�
        This method is used to get the difference between the proposed and existing configurations. Each module
        should call the get_existing method before this method, and add the proposed config to the module results
        using the module's config parameters. The new config will added to the self.result dictionary.

        :param aci_class: Type str.
                          This is the root dictionary key for the MO's configuration body, or the ACI class of the MO.
        RgiR�N(R:R7R�R\tget_diff_childrenR�R8(	RIR�tproposed_configtexisting_configR8tkeyRMtexisting_fieldR�((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pytget_diffYs"		!	cCswiiid6|6}xJ|j�D]<\}}|j|�}||kr!|||d|<q!q!W||dssdS|S(s
        This method is used to get the difference between a proposed and existing child configs. The get_nested_config()
        method should be used to return the proposed and existing config portions of child.

        :param child_class: Type str.
                            The root class (dict key) for the child dictionary.
        :param proposed_child: Type dict.
                               The config portion of the proposed child dictionary.
        :param existing_child: Type dict.
                               The config portion of the existing child dictionary.
        :return: The child config with only values that are updated. If the proposed dictionary has no updates to make
                 to what exists on the APIC, then None is returned.
        RgN(R�R\R5(tchild_classtproposed_childtexisting_childt
update_configR�RMR�((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pytget_diff_childsc
Cs�|j|jd�}|r�g}|jd|jdg�}xp|D]a}|j||�\}}}|dkr||}	n|j|||�}	|	rF|j|	�qFqFWndS|S(s�
        This method is used to retrieve the updated child configs by comparing the proposed children configs
        agains the objects existing children configs.

        :param aci_class: Type str.
                          This is the root dictionary key for the MO's configuration body, or the ACI class of the MO.
        :return: The list of updated child config dictionaries. None is returned if there are no changes to the child
                 configurations.
        R�iN(R:R\R7tget_nested_configR5R�tappend(
RIR�tproposed_childrent
child_updatestexisting_childrentchildR�R�R�tchild_update((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyR��s

	cCs+|j|j}|jdr@|jd|j|jdd�nt|j|d|jddd|jdd|jd�\}}|d|_|d	|_	d|_
|d	d
kr�tj|j
��d|_nTy,|j|d�|jdd
|j�Wn%tk
r&|jdd|�nXdS(sH
        This method is used to get the existing object(s) based on the path specified in the module. Each module should
        build the URL so that if the object's name is supplied, then it will retrieve the configuration for that particular
        object, but if no name is supplied, then it will retrieve all MOs for the class. Following this method will ensure
        that this method can be used to supply the existing configuration when using the get_diff method. The response, status,
        and existing configuration will be added to the self.result dictionary.
        RR=R<R�R2R R!R.R?i�RARksAPIC Error %(code)s: %(text)ss&Connection failed for %(url)s. %(msg)sN(R@R;R0R�R=RR/R2R>R?R<RmR�R}R7RoRGR6Rp(RIturiRrR((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pytget_existing�s$
#	


	
cCs�x�|j�D]|}|}||d}d}xY|D]Q}|j|�r4||d}t|j��jt|j���r�Pq�q4q4Wq
W|||fS(s=
        This method is used for stiping off the outer layers of the child dictionaries so only the configuration
        key, value pairs are returned.

        :param proposed_child: Type dict.
                               The dictionary that represents the child config.
        :param existing_children: Type list.
                                  The list of existing child config dictionaries.
        :return: The child's class as str (root config dict key), the child's proposed config dict, and the child's
                 existing configuration dict.
        RgN(tkeysR5R\R3R�tissubset(R�RR�R�R�R�R((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyR�s

'cCs#td�|j�D��}ii|d6|6|_|rg}x�|D]�}t|�}t}x{|j�D]m}	xd||	dj�D]N\}
}|dkr�||	dj|
�q�t|�||	d|
<t	}q�WqkW|rF|j
|�qFqFW|r|j|jtd|��qndS(s�
        This method is used to dynamically build the proposed configuration dictionary from the config related parameters
        passed into the module. All values that were not passed values from the playbook task will be removed so as to not
        inadvertently change configurations.

        :param aci_class: Type str
                          This is the root dictionary key for the MO's configuration body, or the ACI class of the MO.
        :param class_config: Type dict
                             This is the configuration of the MO using the dictionary keys expected by the API
        :param child_configs: Type list
                              This is a list of child dictionaries associated with the MOs config. The list should only
                              include child objects that are used to associate two MOs together. Children that represent
                              MOs should have their own module.
        css3|])\}}|dk	r|t|�fVqdS(N(R5R(R�R�R�((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pys	<genexpr>	sRgR�N(R%R�R:RR'R	R5tpopRR&RR�(RIR�tclass_configt
child_configsR:R�Rt
child_copyt	has_valuetroot_keyt
final_keystvalues((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyRq�s"
!cCsh|js
dS|jjsN|jdrK|jdddtj|j��nt|j|jdtj|j�d|j	ddd|jdd	|jd	�\}}|d
|_
|d|_d|_|ddkr�t
|jd
<|j|j��qdy,|j|d�|jd
d|j�Wqdtk
rJ|jd
d|�qdXnt
|jd
<d|_dS(s"
        This method is used to handle the logic when the modules state is equal to present. The method only pushes a change if
        the object has differences than what exists on the APIC, and if check_mode is False. A successful change will mark the
        module as changed.
        NRR<RjRqRiR2R R!R.R?i�R*RksAPIC Error %(code)s: %(text)ss&Connection failed for %(url)s. %(msg)s(R8R/R�R0R�RmRnRR@R2R>R?R<R&R1RoR}RGR6Rp(RIRrR((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pytpost_configs0	
%	


	


cKsqd|jkrN|jddkrN|jddkrK|j|jd<qKqNn|jddkr�d|jkr�|j|jd<n|j|jd	<|j|jd
<|j|jd<|j|jd<nd|jkrJ|j|_|jddkr|j	�n|j|jd
<|jddkrJ|j
|jd<|j|jd<qJn|jj|�|j
j|j�dS(NRbR]R_RRRtpreviousR;R<R>R?R@tcurrenttsentR:(sabsentspresent(sdebugsinfo(sabsentspresent(sdebugsinfo(R0R7R1R;R<R>R?R@R9RR8R:R�R/t	exit_json(RItkwargs((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyRGs*
cKs�|jddk	r9|jddk	r9|j|jd<nd|jkr�|jddkr�|jddkr�|j|jd
<q�n|jddkr�|jdk	r�|j|jd<|j|jd<q�q�n|jddkrY|jdk	rYd|jkr|j|jd
<n|j	|jd<|j
|jd<|j|jd<|j|jd<qYnd|jkr�|jddkr�|j|jd<|j
|jd<q�n|jj|�|jjd||j�dS(NR+R,R6RbR]R_RRRRRARBR;R<R>R?R@RR:R.(sabsentspresent(sdebugsinfo(sdebugsinfo(R6R5R1R0R7RARBR@R;R<R>R?R8R:R�R/RG(RIR.R((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyRGks0&N(%t__name__t
__module__RJRRXRCRdRHR5R�RoR�R�R�RaR�R�R�R�R�R�R�R�R�R�R�R�R�tstaticmethodR�R�RRRqRRRG(((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyR)RsB	1				9			
'	&			*	�)		!	B	8	)	&	 	#%	(	$(R�RmRztcopyRt)ansible.module_utils.parsing.convert_boolRtansible.module_utils.urlsRtansible.module_utils._textRRtOpenSSL.cryptoRRRR&RFtImportErrorR't
lxml.etreeR�tHAS_LXML_ETREEtxmljsonRtHAS_XMLJSON_COBRAR(tobjectR)(((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aci/aci.pyt<module>#s.








	

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