Anons79 Mini Shell

Directory : /proc/self/root/lib/python2.7/site-packages/ansible/module_utils/
Upload File :
Current File : //proc/self/root/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyo

�
�Udac@s�ddlZddlZddlZdZy:ddlmZddlmZddl	m
Z
eZWn#e
k
r�ej�ZeZnXddlmZmZmZddlmZdefd��YZd	efd
��YZdefd��YZd
�Zdefd��YZdefd��YZdefd��YZdefd��YZddd�Z dd�Z!dd�Z"d�Z#d�Z$d�Z%dS(i����N(tAdapter(tv3(tsession(t
AnsibleModuletenv_fallbacktmissing_required_lib(tto_texttHwcModuleExceptioncBseZd�Zd�ZRS(cCs tt|�j�||_dS(N(tsuperRt__init__t_message(tselftmessage((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyR	scCsd|jS(Ns[HwcClientException] message=%s(R
(R((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyt__str__s(t__name__t
__module__R	R
(((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyRs	tHwcClientExceptioncBseZd�Zd�ZRS(cCs)tt|�j�||_||_dS(N(RRR	t_codeR
(RtcodeR((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyR	#s	cCs9|jdkr"dt|j�nd}d||jfS(Nis	 code=%s,ts![HwcClientException]%s message=%s(RtstrR
(Rtmsg((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyR
)s((RRR	R
(((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyR"s	tHwcClientException404cBseZd�Zd�ZRS(cCstt|�jd|�dS(Ni�(RRR	(RR((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyR	0scCsd|jS(Ns"[HwcClientException404] message=%s(R
(R((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyR
3s(RRR	R
(((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyR/s	cs�fd�}|S(Nc
s1y&|j|}�||||�}Wn&tk
rN}tdd|��nXd}|jr�y|j�}Wq�tk
r�}tdd|��q�Xn|j}|dkr-d}xHddgD].}	yt||	�}PWq�tk
r�q�Xq�Wt|�}|dkrt	|��nt||��n|S(Nis Sending request failed, error=%ss*Parsing response to json failed, error: %si�i�i�i�i�i�i�i�i�i�RRs
error.messagei�(
i�i�i�i�i�i�i�i�i�i�(
tendpointt	ExceptionRtNonetcontenttjsontstatus_codetnavigate_valueRR(
RturltargstkwargstrtextresultRRti(tf(sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyt_wrap8s6
		
((R%R&((R%sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pytsession_method_wrapper7s#t_ServiceClientcBs�eZd�Zed��Zedddd��Zedddd��Zedddd��Z	edddd��Z
d�ZRS(cCs1||_||_id|d6dd6|_dS(NsHuawei-Ansible-MM-%ss
User-Agentsapplication/jsontAccept(t_clientt	_endpointt_default_header(RtclientRtproduct((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyR	_s
		cCs|jS(N(R+(R((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyRgsc	Cs+|jj|d|d|d|j|��S(NRttimeouttheaders(R*tgett_header(RRtbodytheaderR/((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyR1ksc	Cs+|jj|d|d|d|j|��S(NRR/R0(R*tpostR2(RRR3R4R/((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyR5psc	Cs+|jj|d|d|d|j|��S(NRR/R0(R*tdeleteR2(RRR3R4R/((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyR6usc	Cs+|jj|d|d|d|j|��S(NRR/R0(R*tputR2(RRR3R4R/((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyR7zscCs^|rQt|t�rQxB|jj�D]%\}}||kr%|||<q%q%Wn	|j}|S(N(t
isinstancetdictR,titems(RR4tktv((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyR2s	N(RRR	tpropertyRR'RR1R5R6R7R2(((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyR(^s	tConfigcBsDeZd�Zed��Zd�Zd�Zd�Zd�ZRS(cCsEd|_d|_||_||_i|_|j�|j�dS(N(Rt_project_clientt_domain_clientt_modulet_productt
_endpointst	_validatet_gen_provider_client(RtmoduleR.((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyR	�s					
cCs|jS(N(RA(R((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyRF�scCsI|j}|dkr!|j}n|j|||�}t|||j�S(Ntdomain(R?R@t_get_service_endpointR(RB(Rtregiontservice_typet
service_leveltcte((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyR-�s
	cCs�|j}i|jdd6|jdd6|jdd6|jdd6|jdd	6td
6}ttjdtj|��dt�|_	|j
d�ttjdtj|��dt�|_dS(
Ntidentity_endpointtauth_urltpasswordtusertusernametprojecttproject_nameRGtuser_domain_nametreauthenticatetautht	raise_exc(RAtparamstTrueRRtSessionRtPasswordtFalseR?tpopR@(Rtmtp((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyRE�s	

cCs�d||r|ndf}||jkr;|jj|�Sd}y"|jd|d|dd�}Wn&tk
r�}tdd|��nX|dkr�tdd	|��n|d
dkr�|d7}n||j|<|S(Ns%s.%sRRJtregion_namet	interfacetpublicis!Getting endpoint failed, error=%ssCan not find the enpoint for %si����t/(RCR1Rtget_endpointRR(RR-RJRIR;RR"((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyRH�s"

cCs,ts(|jjdtd�dt�ndS(NRt
keystoneauth1t	exception(tHAS_THIRD_LIBRARIESRFt	fail_jsonRtTHIRD_LIBRARIES_IMP_ERR(R((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyRD�s(	RRR	R=RFR-RERHRD(((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyR>�s	
				t	HwcModulecBseZd�ZRS(cOs&|jdi�}|jtdtdtdddtdgf�dtdtdddtd	gf�d
tdtdddtdtdgf�d
tdtdddtdgf�dtdtdddtdgf�dtdddtdgf�dtdd���tt|�j||�dS(Nt
argument_specRNtrequiredttypeRtfallbacktANSIBLE_HWC_IDENTITY_ENDPOINTRQtANSIBLE_HWC_USERRPtno_logtANSIBLE_HWC_PASSWORDRGtANSIBLE_HWC_DOMAINRStANSIBLE_HWC_PROJECTRItANSIBLE_HWC_REGIONtid(t
setdefaulttupdateR9RZRRRkR	(RRR targ_spec((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyR	�s.(RRR	(((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyRk�st_DictComparisoncBsDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(s{ This class takes in two dictionaries `a` and `b`.
        These are dictionaries of arbitrary depth, but made up of standard
        Python types only.
        This differ will compare all values in `a` to those in `b`.
        If value in `a` is None, always returns True, indicating
        this value is no need to compare.
        Note: On all lists, order does matter.
    cCs
||_dS(N(trequest(RR|((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyR	scCs|j|j|j�S(N(t_compare_dictsR|(Rtother((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyt__eq__scCs|j|�S(N(R(RR~((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyt__ne__
scCsu|dkrtSt|j��t|j��kr8tSx6|D].}|j|j|�|j|��s?tSq?WtS(N(RRZtsettkeysR]t_compare_valueR1(Rtdict1tdict2R;((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyR}
s$
$cCsk|dkrtSt|�t|�kr,tSx8tt|��D]$}|j||||�s?tSq?WtS(s%Takes in two lists and compares them.N(RRZtlenR]trangeR�(Rtlist1tlist2R$((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyt_compare_listssc	Cs�|dkrtS|o|s(|o'|St|t�rVt|t�rV|j||�St|t�r�t|t�r�|j||�St|dd�t|dd�kS(sJ
        return: True: value1 is same as value2, otherwise False.
        terrorstsurrogate_or_strictN(RRZR8tlistR�R9R}R(Rtvalue1tvalue2((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyR�(s(	RRt__doc__R	RR�R}R�R�(((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyR{�s				
	iicCs7t}d}d}tj|�tj�|}	x�|s"tj�|	krSt}n|�\}
}|
dkr�|d7}|dkr�td|��q�n;d}||kr�|
S|r�||kr�td|��n|s2|d9}||kr�|}n|dkrd}ntj|�q2q2Wtd|��dS(Niii
s!not found the object for %d timessunexpect status(%s) occuredis#asycn wait timeout after %d seconds(R]ttimetsleepRZRR(ttargettpendingtrefreshR/tmin_intervaltdelaytis_last_timetnot_found_timestwaittendtobjtstatus((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pytwait_to_finish>s8
		

		cCsJ|r%t|t�r%td��n|}xtt|��D]}|dkrTdSt|t�srtd��n||}||kr�td|��n||}|s�q>ndj||d �}||kr�q>n|dkr�dSt|t�std��n|j|�}|t|�kr8td��n||}q>W|S(Nsarray_index must be dicts+can't navigate value from a non-dict objects3navigate value failed: key(%s) is not exist in dictt.is+can't navigate value from a non-list objects/navigate value failed: the index is out of list(	R8R9RR�R�RtjoinR�R1(tdatatindextarray_indextdtnR$R;tj((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyRhs<

cCs�|dkrt�}ni}x�tjd|�D]o}|dd }||krht||�||<q1||jkr�t|jj|��||<q1d||<q1W|j|�S(Ns{[^/]*}ii����R(RR9tretfindallRRYR1tformat(RFtpathtkvR<R`R�((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyt
build_path�scCs0|jdr|jdS|jdjd�dS(NRIRSt_i(RYtsplit(RF((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyt
get_region�s
cCs|S(N((R<((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pytis_empty_value�scCst|�t|�kS(N(R{(R�R�((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pytare_different_dicts�s(&R�R�t	tracebackRRjtkeystoneauth1.adapterRtkeystoneauth1.identityRRfRRZRhtImportErrort
format_excR]tansible.module_utils.basicRRRtansible.module_utils._textRRRRRR'tobjectR(R>RkR{R�RR�R�R�R�(((sB/usr/lib/python2.7/site-packages/ansible/module_utils/hwc_utils.pyt<module>s6




	',K%D**		

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