HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //proc/self/root/usr/lib/python3.6/site-packages/ipalib/__pycache__/backend.cpython-36.pyc
3

�d[e��@s�dZddlZddlZddlZddlmZddlmZmZm	Z	ddl
mZmZm
Z
eje�ZGdd�dej�ZGdd	�d	e�ZGd
d�de�ZdS)z*
Base classes for all backed-end plugins.
�N)�plugable)�PublicError�
InternalError�CommandError)�context�
Connection�destroy_contextc@seZdZdZdS)�Backendz-
    Base class for all backend plugins.
    N)�__name__�
__module__�__qualname__�__doc__�rr�/usr/lib/python3.6/backend.pyr	#sr	c@sReZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
ee
�ZdS)�Connectiblea$
    Base class for backend plugins that create connections.

    In addition to the nicety of providing a standard connection API, all
    backend plugins that create connections should use this base class so that
    `request.destroy_context()` can properly close all open connections.
    FcCs6tj||�|r|j|_nd|jtt|��f|_dS)Nz%s_%s)r	�__init__�name�id�str)�selfZapiZshared_instancerrrr2s
zConnectible.__init__cOsjtt|j�r(tdj|j|jtj�j���|j||�}t	t|jt
||j��|j|ksXt
�tjd|j�dS)z1
        Create thread-local connection.
        z%{0} is already connected ({1} in {2})zCreated connection context.%sN)�hasattrrr�	Exception�formatr�	threading�current_thread�create_connection�setattrr�
disconnect�conn�AssertionError�logger�debug)r�args�kwrrrr�connect9szConnectible.connectcOstd|j��dS)Nz%s.create_connection())�NotImplementedErrorr)rr"r#rrrrJszConnectible.create_connectioncCsNtt|j�s(tdj|j|jtj�j���|j�t	t|j�t
jd|j�dS)Nz!{0} is not connected ({1} in {2})zDestroyed connection context.%s)rrrrrrrr�destroy_connection�delattrr r!)rrrrrMszConnectible.disconnectcCstd|j��dS)Nz%s.destroy_connection())r%r)rrrrr&ZszConnectible.destroy_connectioncCstt|j�S)zY
        Return ``True`` if thread-local connection on `request.context` exists.
        )rrr)rrrr�isconnected]szConnectible.isconnectedcCs6tt|j�s(tdj|j|jtj�j���tt|j�j	S)z1
        Return thread-local connection.
        z!{0} is not connected ({1} in {2}))
rrr�AttributeErrorrrrr�getattrr)rrrrZ
__get_conncszConnectible.__get_connN)F)
r
rrr
rr$rrr&r(Z_Connectible__get_conn�propertyrrrrrr)s


rc@s&eZdZddd�Zdd�Zdd�ZdS)	�ExecutionerNcCsT|dk	r|tjd<|jjr0|jjj|ddd�n|jjj�|dk	rPtt	d|�dS)zA
        client_ip: The IP address of the remote client.
        NZ
KRB5CCNAME)�ccacheZ
size_limitZ
time_limit�	client_ip)
�os�environ�envZ	in_serverr	Zldap2r$Z	rpcclientrr)rr-r.rrr�create_contextus


zExecutioner.create_contextcCs
t�dS)N)r)rrrrr�szExecutioner.destroy_contextcOs�z|y$||jkrt|d��|j|||�Stk
r<�Yn>tk
rx}z"tjd|jjt|��t	��WYdd}~XnXWdt
�XdS)N)rznon-public: %s: %s)ZCommandrrrr Z	exception�	__class__r
rrr)r�_namer"Zoptions�errr�execute�s

zExecutioner.execute)NN)r
rrr2rr6rrrrr,ss
r,)r
Zloggingrr/ZipalibrZ
ipalib.errorsrrrZipalib.requestrrrZ	getLoggerr
r ZPluginr	rr,rrrr�<module>s
J