Anons79 Mini Shell

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

�
�Udac@s�ddlZddlZddlmZddlmZddlmZddlm	Z	ej
Z
ejZddlZde
fd��YZ
defd	��YZd
efd��YZdS(i����N(tgeneric_urlparse(turlparse(thttp_client(tto_texttUnixHTTPConnectioncBseZd�Zd�ZRS(cCstj|d�||_dS(Nt	localhost(tHTTPConnectiont__init__tpath(tselfR((s</usr/lib/python2.7/site-packages/ansible/module_utils/lxd.pyR.scCs5tjtjtj�}|j|j�||_dS(N(tsockettAF_UNIXtSOCK_STREAMtconnectRtsock(R	R((s</usr/lib/python2.7/site-packages/ansible/module_utils/lxd.pyR
2s(t__name__t
__module__RR
(((s</usr/lib/python2.7/site-packages/ansible/module_utils/lxd.pyR-s	tLXDClientExceptioncBseZd�ZRS(cKs||_||_dS(N(tmsgtkwargs(R	RR((s</usr/lib/python2.7/site-packages/ansible/module_utils/lxd.pyR9s	(RRR(((s</usr/lib/python2.7/site-packages/ansible/module_utils/lxd.pyR8st	LXDClientcBs_eZdded�Zdddd�Zd�Zdddd�Zd�Ze	d��Z
RS(cCs�||_||_g|_|jd�r�||_||_tt|j��}tj	tj
j�}|j|d|�t
|jd�d|�|_n=|jd�r�|td�}t|�|_ntd��dS(s�LXD Client.

        :param url: The URL of the LXD server. (e.g. unix:/var/lib/lxd/unix.socket or https://127.0.0.1)
        :type url: ``str``
        :param key_file: The path of the client certificate key file.
        :type key_file: ``str``
        :param cert_file: The path of the client certificate file.
        :type cert_file: ``str``
        :param debug: The debug flag. The request and response are stored in logs when debug is true.
        :type debug: ``bool``
        shttps:tkeyfiletnetloctcontextsunix:s"URL scheme must be unix: or https:N(turltdebugtlogst
startswitht	cert_filetkey_fileRRtssltcreate_default_contexttPurposetCLIENT_AUTHtload_cert_chaintHTTPSConnectiontgett
connectiontlenRR(R	RRRRtpartstctxtunix_socket_path((s</usr/lib/python2.7/site-packages/ansible/module_utils/lxd.pyR?s					!c	Cs�|j||d|d|d|�}|ddkr�dj|d�}|jd|�}|d	d
dkr�|j|�q�n|S(Nt	body_jsontok_error_codesttimeoutttypetasyncs{0}/waitt	operationtGETtmetadatatstatustSuccess(t
_send_requesttformatt_raise_err_from_json(R	tmethodRR*R+R,t	resp_json((s</usr/lib/python2.7/site-packages/ansible/module_utils/lxd.pytdo[s$cCs*idd6|d6}|jddd|�S(NtclientR-tpasswordtPOSTs/1.0/certificatesR*(R4(R	ttrust_passwordR*((s</usr/lib/python2.7/site-packages/ansible/module_utils/lxd.pytauthenticatedscCsEytj|�}|jj||d|�|jj�}|j�}t|dd�}tj|�}	|jj	idd6i|d6|d6|d6|d	6d
6i|	d6d6�|	j
dd�}
|
dkr|dk	r�|	d
|kr�|	S|	ddkr|	S|j|	�n|	SWn(t
jk
r@}tdd|��nXdS(Ntbodyterrorstsurrogate_or_strictssent requestR-R7RtjsonR,trequesttresponseterrort
error_codes"Certificate already in trust stores cannot connect to the LXD serverterr(RBtdumpsR%RCtgetresponsetreadRtloadsRtappendR$tNoneR6R
RER(R	R7RR*R+R,R?trespt	resp_dataR8t	resp_typete((s</usr/lib/python2.7/site-packages/ansible/module_utils/lxd.pyR4hs*#cCs;i}|jr|j|d<nt|j|�|��dS(NR(RRRt_get_err_from_resp_json(R	R8t
err_params((s</usr/lib/python2.7/site-packages/ansible/module_utils/lxd.pyR6�s	cCs^d}|jdd�}|dk	r9|jdd�}n|dkrZ|jdd�}n|S(NR1RGRE(RMR$(R8RGR1((s</usr/lib/python2.7/site-packages/ansible/module_utils/lxd.pyRR�sN(RRRMtFalseRR9R>R4R6tstaticmethodRR(((s</usr/lib/python2.7/site-packages/ansible/module_utils/lxd.pyR>s			(R
Rtansible.module_utils.urlsRt+ansible.module_utils.six.moves.urllib.parseRtansible.module_utils.six.movesRtansible.module_utils._textRRR#RBRt	ExceptionRtobjectR(((s</usr/lib/python2.7/site-packages/ansible/module_utils/lxd.pyt<module>s		

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