Edit File: packages.cpython-311.opt-1.pyc
� 5/9eF2 � �� � d dl mZ d dl mZ d dlZd dlZd dlmZ d dlmZ d dl m Z mZ d dlm Z mZmZ dd lmZ d d lmZ d dlmZ d dlmZmZmZ d d lmZ d dlmZmZ G d� de� � Z dS )� )�print_function)�absolute_importN)� iteritems)�CloudlinuxLicenseLib)�print_dictionary�replace_params)� ClQuotaLib�QuotaDisabledException�ClQuotaException� )�parse_cloudlinux_packages_opts)� LveCtlPackage)�LvectlException)�DEFAULT_PACKAGE�is_active_reseller_limits�lve)�is_admin)� MySQLGovernor�MySQLGovExceptionc �F � e Zd ZdZd� Zd� Zd� Zd� Zd� Zd� Z dd �Z dd�Zd S )�CloudlinuxPackagesz4 Class for run cloudlinux-packages commands c � � d| _ t � � | _ t � � | _ t � � | _ g d�| _ t � � | _ d S )NF) �speed�nproc�pmem�vmem� maxEntryProcs�io�iops�inodes� mysql-cpu�mysql-io) �_is_json�dict�_optsr �_lvectl_pack_libr �_clquota_pack_lib�_LIMITS_KEYSr �_mysql_governor)�selfs �py/clpackages/packages.py�__init__zCloudlinuxPackages.__init__# sR � ��� ��V�V�� � -�����!+�����6� 6� 6���,������� c � � t � � }|� � � sd| _ | � ddi� � S d|v | _ | � |� � | _ | j � d� � r*t j � � s| � ddi� � | j d r| � � � S | � � � S )z$ Run command action T�resultzCloudlinux license isn't validz--json�--for-resellerzLerror: reseller limits are not supported, can not use --for-reseller option.�set)r �get_license_statusr# �_error_and_exit�_parse_argsr% �getr �reseller_limit_supported�_set_run�_get_run)r* �argv�licences r+ �runzCloudlinuxPackages.run, s� � � '�(�(���)�)�+�+� V� �D�M��'�'��3S�(T�U�U�U� �D�(�� ��%�%�d�+�+�� ��:�>�>�*�+�+� �C�4P�4R�4R� �� � ��h�"� � � � �:�e�� #��=�=�?�?�"��=�=�?�?�"r- c �~ � t || j � � \ }}|s"| � t |� � � � |S )z% Parse CLI arguments )r r# r3 r )r* r9 �status�datas r+ r4 zCloudlinuxPackages._parse_argsA sB � � 6�d�D�M�J�J����� 7�� � ���!5�!5�6�6�6��r- c � �� | j }t |d t � � r|d � d� � nd�t �fd�| j D � � � � }t � � }| j d }d}| j d �2| j d � � � � d� � } | j � ||| j d � � }nE# t $ r8}| � t |j |j � � � � � Y d}~nd}~ww xY w|d �r0| j � � � s"d|d<