????
| Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/wmt/common/__pycache__/ |
| Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/wmt/common/__pycache__/utils.cpython-311.pyc |
�
�Y_���� � � d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlZd dlZd dl m
Z
d dlmZ d dl
mZ d dlmZmZmZmZmZmZ d� Zd� Ze j d ed
efd�� � Zd� Zdd
�Zd� Zd� Zd� Zd� Z d� Z!dd�Z"dS )� N)�urlparse)�cpapi)�get_rhn_systemid_value)�parse)�CLICKHOUSE_WMT_ENDPOINT� JWT_TOKEN�UNKNOWN_RHN_ID�SERVICE_BIN�
CHKCONFIG_BIN�
SYSTEMCTL_BINc �T � t � � } t j t j k r d� t j d�� � D � � }nt j � � }|s| S t j � � }n&# t $ r t j d� � g }Y nw xY wt j dk r"t � � t j j _
|D ]X}||v rt j d|� � �t j |� � D ]'\ }}| � t# |� � � � �(�Y| S )Nc � � g | ]
}|d ��S )r � )�.0�_cpinfos ��/builddir/build/BUILDROOT/cl-web-monitoring-tool-3.2.3-1.el9.cloudlinux.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/wmt/common/utils.py�
<listcomp>zget_domains.<locals>.<listcomp>$ s � �L�L�L�����L�L�L� )�cplogin)�keylsz%Cannot obtain list of suspended users�cPanelz<User: %s is will not be pinged, because account is suspended)�setr �CP_NAME�
PLESK_NAME�cpinfo�cpusers�suspended_users_list� Exception�logging� exception�dict�plugins�cpanel�_user_to_domains_map_cpanel�warning�userdomains�addr )�domains�users�suspended_users�user�domain�_s r �get_domainsr. ! s4 � ��e�e�G��}��(�(�(�L�L�5�<�l�+K�+K�+K�L�L�L����
����� �����4�6�6����� � � ���A�B�B�B���������
�}�� � �;?�6�6��
��8�� '� '���?�"�"��O�Z�\`�a�a�a���*�4�0�0� '� '�I�F�A��K�K��f�
�
�&�&�&�&� '��Ns �!A5 �5 B�Bc �� � t j | � � }|� t j � � t j d� � } t j d� � }t j |� � n# t j |� � w xY w t j |j d� � n# t $ r Y nw xY wt j
d� � |_ |� |� � n# t $ r Y nw xY w|S )N�_ z/var/log/cl_wmt.logi� z*[%(levelname)s | %(asctime)s]: %(message)s)r � getLogger�setLevel�DEBUG�os�umask�FileHandler�chmod�baseFilename�OSError� Formatter� formatter�
addHandler�IOError)�logger_name�
app_logger� old_umask�fhs r �setup_loggerrB = s � ��"�;�/�/�J�����
�&�&�&�"��H�U�O�O� � ��$�%:�;�;�B��H�Y������B�H�Y��������� ��H�R�_�e�,�,�,�,��� � � ��D� �����(�)U�V�V������b�!�!�!�!�� �
�
�
���
���� �s; �C( �
A3 �C( �3B � C( �B) �)
B6�5B6�(
C5�4C5�file�pidc # �V K � t | d� � } t j |� � � t j t j z � � n4# t $ r' |� � � t
d|z � � �w xY w |� d� � |� � � |�
|� � |� � � t j
|� � d V � t j |� � � t j � � |� � � t j | � � d S # t j |� � � t j � � |� � � t j | � � w xY w)Nza+zProcess %s already running!r )�open�fcntl�flock�fileno�LOCK_EX�LOCK_NBr9 �close�seek�truncate�write�flushr4 �fsync�LOCK_UN�remove)rC rD �fs r �save_pid_and_lockrU U sI � � � �
�T�4���A�;�
��A�H�H�J�J��
��
� =�>�>�>�>��� ;� ;� ;� ��� � � ��3�c�9�:�:�:�;����
� ���q� � � � �
�
���� ������� ��� � � �
������
����
��A�H�H�J�J��
�.�.�.� ��� � � �
� �$������� ��A�H�H�J�J��
�.�.�.� ��� � � �
� �$�������s �>A �1B�A*E
�
AF(c �B � i }| D ]}||v r| | || f||<