????
Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/wmt/common/__pycache__/ |
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/wmt/common/__pycache__/utils.cpython-311.pyc |
� �Ie9 � � � d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZ d dlm Z d dl mZ d dlm Z mZ d� Zd� Ze j ded efd �� � Zd� Zd� Zd � ZdS )� N)�cpapi)�get_rhn_systemid_value)�parse)�CLICKHOUSE_WMT_ENDPOINT�UNKNOWN_RHN_IDc � � t � � } t j t j k r d� t j d�� � D � � }nt j � � }|sg S t j dk r"t � � t j j _ |D ]>}t j |� � D ]'\ }}| � t |� � � � �(�?| S )Nc � � g | ] }|d ��S )r � )�.0�_cpinfos ��/builddir/build/BUILDROOT/cl-web-monitoring-tool-2.1.4-1.el8.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)�keyls�cPanel) �setr �CP_NAME� PLESK_NAME�cpinfo�cpusers�dict�plugins�cpanel�_user_to_domains_map_cpanel�userdomains�addr )�domains�users�user�domain�_s r �get_domainsr# s� � ��e�e�G��}��(�(�(�L�L�5�<�l�+K�+K�+K�L�L�L���� ����� �� � �}�� � �;?�6�6�� ��8�� '� '���*�4�0�0� '� '�I�F�A��K�K��f� � �&�&�&�&� '��Nr c � � t j | � � }|� t j � � t j d� � }t j d� � |_ |� |� � n# t $ r Y nw xY w|S )Nz/var/log/cl_wmt.logz*[%(levelname)s | %(asctime)s]: %(message)s) �logging� getLogger�setLevel�DEBUG�FileHandler� Formatter� formatter� addHandler�IOError)�logger_name� app_logger�fhs r �setup_loggerr1 . s� � ��"�;�/�/�J����� �&�&�&�"� � �!6� 7� 7�� �(�)U�V�V������b�!�!�!�!�� � � � ��� ���� �s �A8 �8 B�B�file�pidc # �" K � t j � | � � sdnd}t | |� � } t j |� � � t j t j z � � n # t $ r t d|z � � �w xY w |� |� � |� � � t j |� � d V � t j |� � � t j � � |� � � t j | � � d S # t j |� � � t j � � |� � � t j | � � w xY w)Nzw+zr+zProcess %s already running!)�os�path�exists�open�fcntl�flock�fileno�LOCK_EX�LOCK_NB�OSError�write�flush�fsync�LOCK_UN�close�remove)r2 r3 �mode�fs r �save_pid_and_lockrG ; s: � � � ��w�~�~�d�+�+�5�4�4��D��T�4���A�;� ��A�H�H�J�J�� �� � =�>�>�>�>��� ;� ;� ;��3�c�9�:�:�:�;����� ������� ��� � � � ������ ���� ��A�H�H�J�J�� �.�.�.� ��� � � � � �$������� ��A�H�H�J�J�� �.�.�.� ��� � � � � �$�������s �>A6 �6B�AD3 �3AFc �B � i }| D ]}||v r| | || f||<