Anons79 Mini Shell

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

�
�Udac@`sVddlmZmZmZddlZddlZddlZddlmZm	Z	ddlm
Z
ddlmZy@ddl
Z
ddlmZddlmZddlmZWn)ek
r�Zd	efd
��YZnXiidd6ed
6d6idd6d6id6idd6ed6d6idd6dd6d6Zde
fd��YZdS(i(tabsolute_importtdivisiontprint_functionN(t
AUTH_ARG_SPECtCOMMON_ARG_SPEC(tKubernetesAnsibleModule(tstring_types(twatch(tResourceInstance(tKubernetesExceptionR	cB`seZRS((t__name__t
__module__(((sB/usr/lib/python2.7/site-packages/ansible/module_utils/k8s/scale.pyR	#stintttypetrequiredtreplicastcurrent_replicastresource_versiontbooltdefaulttwaititwait_timeouttKubernetesAnsibleScaleModulecB`sPeZdd�Zd�Zed��Zd�Zd�Zd�Z	d�Z
RS(c	O`s�d|_g|_d
g}tj|d|dt||�|pO|jjd�|_|jjd�|_	|jjd�|_
|jjd�|_|jjd�}|r6t|t
�rytj|�|_Wq3ttjfk
r}|jd	d
j|��q3Xq6t|t�r'||_q6|g|_n|jjd�}|rc|j|�|_n|r�|r�td|jd|j	dtd|j
��}|jr�|j|dd<n|g|_ndS(Ntresource_definitiontsrctmutually_exclusivetsupports_check_modetkindtapi_versiontnamet	namespacetmsgs&Error loading resource_definition: {0}t
apiVersiontmetadata(sresource_definitionssrc(tNonetclienttwarningsRt__init__tTruetparamstgetRRRRt
isinstanceRtyamlt
safe_load_alltresource_definitionstIOErrort	YAMLErrortfailtformattlisttload_resource_definitionstdict(	tselftk8s_kindtargstkwargsRRtexcRtimplicit_definition((sB/usr/lib/python2.7/site-packages/ansible/module_utils/k8s/scale.pyR%2s@			 			cC`s�|jd}|j�|_|dd}|djd�}|d}|d}|jjd�}|jjd�}|jjd	�}|jjd
�}	|jjd�}
d}d}tdtd
t��}
|j||dt	�}y,|jd|d|�}|j
�|
d
<Wn>tk
rS}|jddj
|�d|jjd��nX|jdkrr|jj}n!t|jd�r�|jj}n|dkr�|jdd�n|r�||jjkr�|j|
�n|dk	r||kr|j|
�n||kr�t	|
d<|js�|jdkrT||j_|j|j
��}n|j||||	|
�}|j
�|
d
<q�n|j|
�dS(NiR!RRR RRRRRRtchangedtresultR/Rs(Failed to retrieve requested object: {0}terrortstatustjobs@Failed to retrieve the available count for the requested object.(R,tget_api_clientR#R(R'R"R3tFalset
find_resourceR&tto_dictR	t	fail_jsonR0tvalueRtspectparallelismthasattrRR!tresourceVersiont	exit_jsont
check_modetpatchtscale(R4t
definitionRRRRRRRRt	wait_timetexistingtexisting_counttreturn_attributestresourceR8tk8s_obj((sB/usr/lib/python2.7/site-packages/ansible/module_utils/k8s/scale.pytexecute_module\sP



	cC`sGtjt�}|jd�|jd�|jt�|jt�|S(Ntstatetforce(tcopytdeepcopyRtpoptupdateRtSCALE_ARG_SPEC(R4R6((sB/usr/lib/python2.7/site-packages/ansible/module_utils/k8s/scale.pytargspec�s



c
C`s7|jj}|jj}t|d�sF|jddj|j��nii|d6|d6d6i|d6d6}d}	d}
|r�|j|||�\}}
ny|j	j
d	|�Wn,tk
r�}|jdd
j|��nX|r|
dk	r|j|||
||�}	n|	s3|j
|||�}	n|	S(NRLRs,Cannot perform scale on resource of kind {0}RRR!RREtbodysScale request failed: {0}(R!RRRGRCR0RR"t_create_streamRLRKt	Exceptiont_read_streamt_wait_for_response(
R4RRtexisting_objectRRRNRRt	scale_objt
return_objtstreamtwR8((sB/usr/lib/python2.7/site-packages/ansible/module_utils/k8s/scale.pyRL�s(	)	cC`s�d}d}yptj�}|jj|_|rW|j|jdtd|d|�}n$|j|jdtd|d|�}Wntk
r�nX||fS(s* Create a stream of events for the object t	serializeRttimeout_secondsN(	R"RtWatchR#t_api_clientReR(R@R	(R4RRRRNRfRe((sB/usr/lib/python2.7/site-packages/ansible/module_utils/k8s/scale.pyR^�s'(
c
C`s�d
}y�x�|D]�}|jd�rt||d�}|jj|kr�t|d�r�|dkr�t|jd�s�|jjr�|}|j�Pq�nt|jd�r�|jj|kr�|}|j�Pq�q�qqWWn,t	k
r
}	|j
ddj|	��nX|s'|j
dd�n|rR|jjd
krR|j
dd�n|r�|jj|kr�|j
dd	j|jj|��n|S(sD Wait for ready_replicas to equal the requested number of replicas. tobjectR=it
readyReplicasRs#Exception reading event stream: {0}sCError fetching the patched object. Try a higher wait_timeout value.sNFailed to fetch the number of ready replicas. Try a higher wait_timeout value.scNumber of ready replicas is {0}. Failed to reach {1} ready replicas within the wait_timeout period.N(
R"R(RR!RRGR=RltstopR_RCR0tready_replicas(
R4RRtwatcherReRRRdteventtobjR8((sB/usr/lib/python2.7/site-packages/ansible/module_utils/k8s/scale.pyR`�s2
! 
$
cC`skd}tjd�}d}xI||krf|jd|d|�}|rLPn|d7}tjd�qW|S(s Wait for an API response iiiRRg$@N(tmathtceilR"R(ttimetsleep(R4RRRRttriesthalfRq((sB/usr/lib/python2.7/site-packages/ansible/module_utils/k8s/scale.pyRa�s
N(R
RR"R%RTtpropertyR\RLR^R`Ra(((sB/usr/lib/python2.7/site-packages/ansible/module_utils/k8s/scale.pyR0s*	6		 		(t
__future__RRRRWRrRttansible.module_utils.k8s.commonRRRtansible.module_utils.sixRR*t	openshiftRtopenshift.dynamic.clientRtopenshift.helper.exceptionsR	tImportErrorR8R_R&R[R(((sB/usr/lib/python2.7/site-packages/ansible/module_utils/k8s/scale.pyt<module>s(

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