| Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/clcommon/__pycache__/clhook.cpython-311.pyc |
�
^Sen � � � d dl mZ d dl mZ d dl mZ d dlZd dlZd dlZd dlZd dl Z dZ
dZdZdZ
d � Zd
� Ze
fd�Ze
fd�Ze
fd
�Zd� ZdS )� )�absolute_import)�division)�print_functionNz/etc/sysconfig/cloudlinux�hooks�;zpython-cllib:clhook:c �t � t j dd�� � }t |_ |� | � � |S )z6
read config from file_name
return config
NF)�
interpolation�strict)�configparser�ConfigParser�str�optionxform�read)� file_name�configs ��/builddir/build/BUILDROOT/alt-python27-cllib-3.3.8-1.el8.cloudlinux.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/clcommon/clhook.py�
get_configr s8 � �
�
&�T�%�
H�
H�
H�F��F��
�K�K� �����M� c �D � |dz t t j � � � � z }t |d� � }| � |� � |� � � t
j ||� � n'# t $ r d|t |� � z dz gcY S w xY wddgS )zG
write config to file_name
return [BOOLEAN_STATE, MESSAGE]
�.�wFz
write error
T�OK
) r
�os�getpid�open�write�close�shutil�move�IOError)r r �debug_local_name�tmp_cfg_path� tmpconfigs r �write_configr$ $ s� � �
M� �3���R�Y�[�[�)9�)9�9����c�*�*� ����Y������������L�)�,�,�,�,��� M� M� M��'�#�i�.�.�8�;K�K�L�L�L�L�M�����&�>�s �A4A7 �7!B�Bc �� � g }t |� � } |� t | � � � t � � }n%# t
j t
j f$ r d|gcY S w xY wd|gS )z+
return [BOOLEAN_STATE, hook_list]
FT)r �get�HOOK_SECTION�split�HOOK_SEPARATORr �
NoOptionError�NoSectionError)�hook_prefix�config_file� hook_listr s r �get_hook_list_from_filer/ 4 s� � � �I�
��
$�
$�F�"��J�J�|�[�9�9�?�?��O�O� � ���&��(C�D� "� "� "��y�!�!�!�!�"�����)��s �3A �A)�(A)c �| � t dz }t |� � } |� t |� � � t
� � }| |v rd|dz t
| � � z dz gS |� | � � |� t |t
� |� � � � nw# t j $ r9 |� t � � |� t || � � Y n0t j
$ r |� t || � � Y nw xY wt |||� � S )zE
add hook to config file
return [BOOLEAN_STATE, MESSAGE]
zregister_hook:TzHook z already registred
)�DEBUG_STRINGr r&