관리-도구
편집 파일: lvectl_lib.cpython-311.opt-1.pyc
� �EBg�C � � � d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZ d dl m Z G d� de� � Z G d� d � � ZdS ) � N)�cpapi)�FormattedException)�exec_utility)�(_convert_memory_value_to_adaptive_formatc � � e Zd ZdS )�LvectlExceptionN)�__name__� __module__�__qualname__� � �py/cllimits/lvectl_lib.pyr r s � � � � � ��Dr r c �� � e Zd ZdZdZdZdZdZdZdZ dZ d� Zed� � � Z dd �Zdd �Zdd�Zd� Zd � Zdd�Zd� Zdd�Zd� Zd� Zdd�Zd� Zd� Zd� Zd� Zd� Zd� Zdd�ZdS )�LveCtlz* Library for work with LVE limits i@B i ʚ;Nz/usr/sbin/lvectlc �| � t | j dg� � \ }}t |� � | _ d| _ d| _ dS )z5 Object constructor. Get LVE version zlve-versionN)r � _UTILITY_PATH�int�lve_version� _package_data�_resellers_data)�self�_� s_lve_versions r �__init__zLveCtl.__init__$ sC � � (��(:�]�O�L�L���=��}�-�-���!���#����r c � � t j � � } t | � � � � � }|� d� � |S )zH Get panel users uid list :return: List of uids r )r � list_users�list�keys�append)� user_packages�uid_lists r �get_panel_users_uid_listzLveCtl.get_panel_users_uid_list- sB � � �(�*�*� �� �*�*�,�,�-�-����������r Fc �� � | � ||�� � || j v r$t j | j | � � }|d= |S t j | j d � � }|d= |S )z� Reads limits by user id :param user_id: user/lve id :param human_readable_numbers: if True PMEM and VMEM limits in KBytes, MBytes or GBytes False - in bytes :return: dictionary )�userid�PACKAGEr )� _load_infor �copy�deepcopy)r �user_id�human_readable_numbers�user_limitss r �get_limits_by_user_idzLveCtl.get_limits_by_user_id8 su � � ���.�w��?�?�?��d�(�(�(��-��(:�7�(C�D�D�K��I�&��� �m�D�$6�q�$9�:�:��� �"��r c � � | � ||� � t j | j � |� � � � }|S )a Reads limits by reseller name :param reseller_name: :param: id - user/lve id :param human_readable_numbers: if True PMEM and VMEM limits in KBytes, MBytes or GBytes False - in bytes :rtype: dict )�_load_resellers_infor'