Edit File: cl_summary_utils.cpython-311.pyc
� c|9e�+ � � � d dl mZmZ d dlmZmZmZmZmZ d dl m Z d dlmZm Z d dlmZmZ d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlmZ d dlmZ d d lmZ d d lm Z d dl!m"Z"m#Z# d� Z$ d d l%m&Z& d dl'm(Z( n# e)$ r e$Z&e$Z(Y nw xY wdZ*dZ+dZ,dZ-ej. �/ e-d� � Z0dZ1da2dZ3dZ4 G d� de5� � Z6d� Z7d� Z8d6d�Z9d� Z:d� Z;d7d e<d!e=d"e=fd#�Z>d e<d$e=d"dfd%�Z?d"e=fd&�Z@d"e=fd'�ZAd(e=d"dfd)�ZBd(e=d"dfd*�ZCd+� ZDd,� ZEd-� ZFd.� ZGd/� ZHd0� ZId1� ZJd2� ZKd7d"eeeeee=f f fd3�ZLd4� ZMd"ee fd5�ZNdS )8� )�absolute_import�division)�Optional�Dict�AnyStr�Union�List)�DEFAULT_JWT_ES_TOKEN_PATH)�process_is_running�get_cl_version)�decode� exceptionsN)�mkdir)�CL_CONFIG_FILE)�write_file_via_tempfile)�check_cagefs_initialized)� WhmApiRequest�WhmApiErrorc � � d S )N� )�a�kws �Q/opt/cloudlinux/venv/lib64/python3.11/site-packages/clsummary/cl_summary_utils.py�dummy_none_functionr s � ��4� ��"interpreter_versions_short_summary)�is_clpassenger_active� license_check�cl_statistics_enabled�cl_statistics_rpm_enabledz/var/lvezsummary_status.jsonz%/var/run/cloudlinux_summary.send.lockz./usr/share/cloudlinux/cl_plus/clplus_sender.pyz#/opt/cloudlinux/venv/bin/virtualenvc � � e Zd ZdZdZdZdZdS )� SummaryStatusz� Status of both, collecting and sending statistics If process still collects statistics -> IN_PROGRESS If statistics collected and sent correctly -> SUCCESS If any error during collecting or sending -> FAILED �success�in_progress�failedN)�__name__� __module__�__qualname__�__doc__�SUCCESS�IN_PROGRESS�FAILEDr r r r# r# 7 s) � � � � � �� � �G��K� �F�F�Fr r# c �J � t j � t � � S )zS Checks is virtualenv installed :return: True/False - installed or not )�os�path�exists�ALT_PYTHON_VIRTUALENV_BINr r r �is_virtualenv_installedr3 C s � � �7�>�>�3�4�4�4r c � � t j dt j ddddd� � } t j | t j |� � }t j d|� � d }n# t t f$ r Y dS w xY w|t j k S )a$ Check if file is locked by another process without acquiring lock. IMPORTANT! This function should NOT be used to check lock acquired by the same process that executes the is_locked() function. For example, when process executes fcntl.lockf(LOCK_FILE), and then the same process executes is_locked(LOCK_FILE), the is_locked(LOCK_FILE) call returns False. Use is_locked() function to check lock acquired by another process only. :param lock_file: file to check lock on :type lock_file: file object or descriptor �hhllhhr F) �struct�pack�fcntl�F_WRLCK�F_GETLK�unpack�OSError�IOError�F_UNLCK)� lock_file� lock_data� lock_query�lock_statuss r � is_lockedrC K s� � � ��H�e�m�Q��1�a��C�C�I���[��E�M�9�E�E� ��m�H�j�9�9�!�<�����W�� � � ��u�u����� �%�-�'�'s �;A"