Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/cllimits/lib/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/cllimits/lib/__pycache__/limits.cpython-311.pyc

�

".g�����ddlZddlZddlmZddlmZddlmZddlm	Z	m
Z
mZmZm
Z
mZmZmZmZmZddlmZddlmZmZmZddlmZmZdd	lmZdd
lmZm Z m!Z!m"Z"ddl#m$Z$m%Z%m&Z&ddl'm(Z(m)Z)m*Z*d
dl+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5d
dl6m7Z7Gd�de��Z8d�d�d�d�d�d�d�d�d�d�d�
Z9gd�Z:ddgZ;Gd �d!��Z<Gd"�d#e<��Z=dS)$�N)�defaultdict)�ClPwd)�FormattedException)
�Feature�NotSupported�cpinfo�domain_owner�get_main_username_by_uid�	getCPName�is_admin�is_panel_feature_supported�is_reseller�reseller_users)�
EncodingError)�
MySQLGovernor�MySQLGovException�GovernorStatus)�print_dictionary�replace_params)�CloudlinuxLicenseLib)�CageFs�CageFsException�LveCtl�LvectlException)�ClQuotaException�
ClQuotaLib�QuotaDisabledException)�convert_to_kernel_format�is_active_reseller_limits�lve�)
�ADMIN_ONLY_OPTIONS�AVAILABLE_KEYS�AVAILABLE_LIMITS�AVAILABLE_LVE_KEYS�AVAILABLE_LVP_KEYS�AVAILABLE_MYSQL_KEYS�AVAILABLE_MYSQL_KEYS_ALL�AVAILABLE_QUOTA_KEYS�CloudlinuxLimitsNoLveOptsParser�CloudlinuxLimitsOptsParser)�convert_mem_value_to_bytesc��eZdZdS)�DomainExceptionN)�__name__�
__module__�__qualname__���py/cllimits/lib/limits.pyr.r.$s�������Dr3r.c���|d�dttt|���r|�d�n|����dz��i��S)N�cpu�all�%�d)�update�str�intr�isdigit��limits�values  r4�<lambda>rA)sr��
�5�M���
�s�3�/�u�}�}���1;�5�����5:�<�<�=�=�@C�D�E�E����r3c�<�|d�d|i��S)N�ior7�r:r>s  r4rArA.s���t�� 3� 3�U�E�N� C� C�r3c�<�|d�d|i��S)Nr6�mysqlrDr>s  r4rArA/s��v�e�}�';�';�W�e�<L�'M�'M�r3c�<�|d�d|i��S)NrCrFrDr>s  r4rArA0s��f�T�l�&9�&9�7�E�:J�&K�&K�r3c���|d�|�d��d���|�d��d���d���S)N�inodes�,rr!��soft�hard)r:�split�stripr>s  r4rArA1se��F�8�$4�$;�$;����C� � ��#�)�)�+�+����C� � ��#�)�)�+�+�=�=�%�%�r3c�0�|�d|i��S)N�eprDr>s  r4rArA5s��6�=�=�$���+G�+G�r3c�0�|�d|i��S)N�nprocrDr>s  r4rArA6s��6�=�=�'�5�1A�#B�#B�r3c�J�|�dt|��i��S)N�pmem�r:r,r>s  r4rArA7�$��
�M�M�6�5�e�<�<�=�>�>�r3c�J�|�dt|��i��S)N�vmemrVr>s  r4rArA9rWr3c�0�|�d|i��S)N�iopsrDr>s  r4rArA;s��&�-�-����"@�"@�r3)
�speedrC�	mysql-cpu�mysql-iorI�
maxEntryProcsrSrUrYr[)�root�admin�-�abusers�singlec� ��eZdZdZdZdZdZdZdZdZ	�fd�Z
d�Zd+d�Zd�Z
d	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zdefd�Zd�Zdedededdfd�Zd�Zd�Zd�Zd�Ze d���Z!d�Z"d �Z#d!�Z$d"�Z%d#�Z&d$�Z'd%�Z(d&�Z)d'�Z*d(�Z+d,d*�Z,�xZ-S)-�CloudlinuxLimitsz2
    Class for run cloudlinux-limits commands
    NFc����ttj��s2ttt
���t
��St���|��S�N)r
r�LVE�superrf�CloudlinuxLimitsNoLve�__new__)�cls�	__class__s �r4rlzCloudlinuxLimits.__new__RsM���)�'�+�6�6�	a��)�+@�A�A�I�I�J_�`�`�`��w�w���s�#�#�#r3c��t��|_t��|_t	��|_t
��|_t��|_	t��|_i|_dS)z#
        Empty constructor
        N)
r�_clpwdr�_lvectlr�_cagefsr�	_cl_quotar�_mysql_governorr+�_opts_parser�_users_list��selfs r4�__init__zCloudlinuxLimits.__init__WsZ��
�g�g����x�x����x�x���#�����,�����6�8�8�������r3�successc��t|t��r)|�|tj��d���t	||jp|��dS)z�
        Output data wrapper
        :param: `dict` data - data for output to stdout
        :param: `bool` force_json - always output json format
        )�result�	timestampN)�
isinstance�dictr:�timer�_is_json)rx�data�
force_jsonr|s    r4�
print_datazCloudlinuxLimits.print_datafsT���d�D�!�!�	F��K�K�6��	���D�D�E�E�E���t�}�:�
�;�;�;�;�;r3c��t��}|���sd|_|�ddi��Sd|v|_|�|��|_|j�d��s|j�d��r:tj��s'|�ddt���d�i��|j�d���*tj
��s|�dd
i��|���|���|jdr|�
��S|jdr|���S|jd
r|���S|jdr|���S|�ddi��S)z$
        Run command action
        Tr|zCloudlinux license isn't validz--json�--for-reseller�--reseller-namez8--for-reseller/--reseller-name options not supported on �.NzEReseller limits are not supported. Can not use --for-reseller option.�set�getzdisable-reseller-limitszenable-reseller-limitszUnknown action, exit)r�get_license_statusr��_error_and_exit�_parse_args�_optsr�r �is_panel_supportedr�reseller_limit_supported�_verify_reseller�_check_user_owner�_set_run�_get_run�_disable_reseller_limits�_enable_reseller_limits)rx�argv�licences   r4�runzCloudlinuxLimits.runqs���'�(�(���)�)�+�+�	V� �D�M��'�'��3S�(T�U�U�U� �D�(��
��%�%�d�+�+��
��:�>�>�*�+�+�	�t�z�~�~�>O�/P�/P�	��)�+�+�
��$�$��g�Yb�Yd�Yd�g�g�g�&�����:�>�>�*�+�+�7��@\�@^�@^�7�� � ��a�"�
�
�
�	
��������� � � ��:�e��	#��=�=�?�?�"��:�e��	#��=�=�?�?�"��:�/�0�	3��0�0�2�2�2��:�.�/�	2��/�/�1�1�1��#�#�X�/E�$F�G�G�Gr3c���|j�||j��\}}|s"|�t	|����t|dt��rd|d<|S)z%
        Parse CLI arguments
        �--lve-idr)ru�
parse_argsr�r�rr~r;)rxr��statusr�s    r4r�zCloudlinuxLimits._parse_args�sn���(�3�3�D�$�-�H�H�����	7�� � ���!5�!5�6�6�6��d�:�&��,�,�	!� �D����r3c�(�|j�d��}|sdS|j�d��dkrdS|���\}}|dvrdS||�|��kr|�d||d�d���dSdS)	z�
        Checks that specified reseller is an owner of specified user and
        terminate program if need
        :return:
        r�Nr�r)N�N/Az2%(username)s is not owned by reseller %(reseller)s)�username�reseller�r|�context)r�r��_check_user�_get_reseller_namer�)rx�for_reseller�_r�s    r4r�z"CloudlinuxLimits._check_user_owner�s����z�~�~�&6�7�7���	��F��:�>�>�*�%�%��*�*��F��&�&�(�(���8��}�$�$�
�F��4�2�2�8�<�<�<�<�� � �N� (� ,���"�"�
�
�
�
�
�=�<r3c��|jds"|jdr|jd|jd<|���|���S)z#
        Run `get` command
        r�r�)r��_get_check_user�_get_action_listrws r4r�zCloudlinuxLimits._get_run�s`���z�+�,�	I���<L�1M�	I�,0�J�7G�,H�D�J�(�)��������$�$�&�&�&r3c��|jdp|jd}	|j�|��|�id��dS#t$r-}|�|j|jd���Yd}~dSd}~wwxYw)z7
        Run `disable-reseller-limits` command
        r��
--reseller-idTr�N)r�rq�disable_reseller_limitsr�rr��messager��rx�res_id�es   r4r�z)CloudlinuxLimits._disable_reseller_limits�s�����-�.�M�$�*�_�2M��	N��L�0�0��8�8�8��O�O�B��%�%�%�%�%���	N�	N�	N�� � �A�I�!�)�!L�!L�M�M�M�M�M�M�M�M�M�����	N���s�0A�
B�"B�Bc�.�|jdp|jdpd}	|j�t|����|�id��dS#t
$r-}|�|j|jd���Yd}~dSd}~wwxYw)Nr�r�z--allTr�)	r�rq�#_set_container_limits_by_id_or_namer;r�rr�r�r�r�s   r4r�z(CloudlinuxLimits._enable_reseller_limits�s����J�(�)�
��z�/�*�
��	�
	N��L�<�<�S��[�[�I�I�I��O�O�B��%�%�%�%�%���	N�	N�	N�� � �A�I�!�)�!L�!L�M�M�M�M�M�M�M�M�M�����	N���s�=A�
B�'"B�Bc�
�|���\}}|�|�||fS|j}|dr�	|�|d��}n9#t$r,}|�|j|jd���Yd}~nd}~wwxYw	|j�|��}n>#tj
$r,}|�|j|jd���Yd}~nd}~wwxYw|�|��s)t|��r|�dd|id���||j
|<�nX|d}|r�t|��}|D]f}	|j�|��}n>#tj
$r,}|�|j|jd���Yd}~nd}~wwxYw||j
|<�gd|j
d<n�	tj��|_n9#t$$r,}|�|j|jd���Yd}~nd}~wwxYwd	}|jD]l}	|j�|��d}n>#tj
$r,}|�|j|jd���Yd}~nd}~wwxYw||j
|<�md}||fS)
z|
        Determines users according to --lve-id/--username/--domain arguments
        Or build all panel users list
        N�--domainr�� %(username)s is not a panel userr�r�r`r�)r�r��get_user_name_by_domainr.r�r�r�rp�get_uidr�NoSuchUserException�get_package_name_by_user_id�boolrvrr�get_panel_users_uid_list�_panel_uids_listr�	get_names)rx�uidr��or��
reseller_name�resellers_users�names        r4r�z CloudlinuxLimits._get_check_user�sh���(�(�*�*�
��X��?�x�3���=� ��J���Z�=�,	�
R��7�7��*�
�F�F����"�
R�
R�
R��$�$��	�a�i�%P�%P�Q�Q�Q�Q�Q�Q�Q�Q�����
R����
R��k�)�)�(�3�3�����,�
R�
R�
R��$�$��	�a�i�%P�%P�Q�Q�Q�Q�Q�Q�Q�Q�����
R�����3�3�C�8�8�
J�T�#�Y�Y�
J��$�$�0R�2<�h�1G�&I�&I�J�J�J�$,�D��S�!�!��/�0�M��
1�"0��"?�"?��+�1�1�D�Z�"�k�1�1�$�7�7���� �4�Z�Z�Z��,�,��	�a�i�-X�-X�Y�Y�Y�Y�Y�Y�Y�Y�����Z����,0�D�$�S�)�)�&,�� ��#�#�V�,2�,K�,M�,M�D�)�)��$�V�V�V��(�(�A�I�!�)�)T�)T�U�U�U�U�U�U�U�U�����V�������0�1�1�C�Z�#�{�4�4�S�9�9�!�<���� �4�Z�Z�Z��,�,��	�a�i�-X�-X�Y�Y�Y�Y�Y�Y�Y�Y�����Z����,0�D�$�S�)�)��C��H�}�sw�A�
B�"A=�=B�B!�!C�0"C�C�E"�"F�1"F�F�7G�
H�"H�H� H6�6I1�"I,�,I1c�6�|j�|��Srh)rqr�)rxr�s  r4r�z,CloudlinuxLimits.get_package_name_by_user_id s���|�7�7��<�<�<r3c��||dd�}|dkr.d|d<d|d<|j�d��}|�|nd|d<nO|�|d��}|r||d<|�|��|d<|�|��|S)	a?
        Retrives username, domain and reseller
        for supplied uid/username, for uid==0 returns '-'
        either reseller_name if has --for-reseller
        :param uid: uid
        :param username: username
        :return: dict {"id": uid, "username": username, "domain": domain, "reseller": reseller}
        rb)�idr�r�r�domainr�r�Nr�)r�r��_get_user_main_domainr��_fix_single_uid_users)rxr�r��userr��user_main_domains      r4�_get_username_domain_resellerz.CloudlinuxLimits._get_username_domain_reseller#s����x�S�A�A���!�8�8� �D��N�"�D����:�>�>�*:�;�;�L�/;�/G�|�|�S�D���� $�9�9�$�z�:J�K�K���
2�!1��X��#�6�6�x�@�@�D����&�&�t�,�,�,��r3c�P�	|�|��S#t$rYdSwxYw)zP
        Retrives user's main domain
        :param username: User name
        N)�get_user_domainr.�rxr�s  r4r�z&CloudlinuxLimits._get_user_main_domain=s=��
	��'�'��1�1�1���	�	�	��4�4�	���s��
%�%r�c��|d}|j�|��}t|��dkrdS|D]J}|�|��}|�|��}|dkr|dkr||d<||d<||d<dS�KdS)	a
        Check and fix user info if some users with same uid present. See LU-1816 for details
        :param user: User info. Example:
            {'id': 10001, 'username': 'cltest2', 'reseller': 'admin', 'domain': 'cltest2.com'}
        :return: None
        r�r!Nr�rbr�r�r�)rpr��lenr�r�)rxr�r��	usernamesr��main_domainr�s       r4r�z&CloudlinuxLimits._fix_single_uid_usersGs����4�j���K�)�)�#�.�.�	��y�>�>�Q����F�!�	�	�H��4�4�X�>�>�K��.�.�x�8�8�H��e�#�#��C���!,��X��#+��Z� �#+��Z� �����	�	r3c�	��i}|j}|j���rd|d<nd|d<|d�$|j���rd|d<nd|d<|j���rd|d<nd|d<t|dt��r|d�	d	��nd�t�fd
�tD����}g}|d�s|d�k|d
�c	|j�
|d|d���n9#t$r,}|�|j|jd���Yd}~nd}~wwxYw	|���}nK#t&$r>}|ddkr&d|d<d|vri|d<t|��|dd<d}Yd}~nd}~wwxYw|j���D�]�\}}|�||��}	|dr�|j���rh	|j�|	d��}
|
rdnd|	d<n=#t0$r0}d|d<d|vri|d<t|��|dd<Yd}~nd}~wwxYw|�|��|	d<|d�|d�|d
�d|j_|j�||d��}|d�|dr|�|||��t;|d|d|d|dg���r|�r	|dr#|j�|	d��|	d<|dr#|j�|	d��|	d<|ds|dr]|j� |	dd���\}}
|drd |vri|d <||d d!<|drd"|vri|d"<|
|d"d!<n=#t&$r0}d|d<d|vri|d<t|��|dd<Yd}~nd}~wwxYw|�!||��||	d#<|�"|	�����tG|��|d$<||d%<|dsk|jj$�Zg}|jj$�%��D]3}|�!||d#��|�"|���4||d&<ng|d&<|�&|d��d'S)(�3
        Process output for selected users
        �enabled�cageFS�disabledr�N�quota�mySqlGov�--limitsrJc3�*�K�|]
}|�p|�vfV��dSrhr2��.0�k�lks  �r4�	<genexpr>z4CloudlinuxLimits._get_action_list.<locals>.<genexpr>y�3�����E�E�q�Q�B��)�!�r�'�*�E�E�E�E�E�Er3r��
--usernamer�z--human-readable-numbersr�)r�r��error�errorsF�cagefsr��packagerIz	mysql-govzmysql-restrictr]r^�mySqlRestrictedT��with_package_markr6rFrCr?�items�users�	resellersr)'r�rr�is_cagefs_presentrs�is_clquota_presentrt�is_governor_presentr~r;rNrr$rq�
_load_inforr�r�r��can_get_governor_limitsrrvr�r��get_user_statusrr��
_package_data�get_limits_by_user_id�_get_inodes_limits�any�get_governor_status_by_username�get_restrict_status_by_username�get_limits_by_user�_filter_limits�appendr��_resellers_data�valuesr�)rxr|r��keysr�r��is_governor_availabler�r�r��
cagefs_statusr?�	cpu_limit�io_limit�resellers_datar�r�s                @r4r�z!CloudlinuxLimits._get_action_list\sJ���
���J���<�)�)�+�+�	*�(�F�8���)�F�8���
��&��~�0�0�2�2�
-�"+��w���",��w����3�3�5�5�	,�!*�F�:���!+�F�:��)3�A�j�M�3�)G�)G�
Q�Q�z�]�
 �
 ��
%�
%�
%�T���E�E�E�E�4D�E�E�E�E�E�����Z�=� �Q�|�_�%<��:��AV�
R���'�'��*D�(E�PQ�Rc�Pd�'�e�e�e�e��"�
R�
R�
R��$�$��	�a�i�%P�%P�Q�Q�Q�Q�Q�Q�Q�Q�����
R����	*�$(�$@�$@�$B�$B�!�!�� �	*�	*�	*��j�!�Y�.�.�%,��z�"��6�)�)�')�F�8�$�36�q�6�6�F�8�$�Z�0�$)�!�!�!�!�!�!�����
	*����"�-�3�3�5�5�9	�9	�M�C���5�5�c�8�D�D�D��H�~�

8�$�,�"@�"@�"B�"B�

8�8�$(�L�$@�$@��j�AQ�$R�$R�M�2?�%O�Y�Y�Z�D��N�N��&�8�8�8�'.�F�8�$��v�-�-�+-��x�(�14�Q���F�8�$�X�.�.�.�.�.�.�����8����#�>�>�s�C�C�D��O���}�(�A�l�O�,G�1�Z�=�Kd�-1���*��\�7�7��Q�?Y�=Z�[�[�F��!�"�*�t�H�~�*��'�'��V�V�<�<�<��D��%�t�,<�'=�t�K�?P�RV�Wa�Rb�c�d�d�
:�-�
:�:��K�(�r�+/�+?�+_�+_�`d�eo�`p�+q�+q��Z�(��,�-�y�26�2F�2f�2f�gk�lv�gw�2x�2x��.�/��K�(�
=�D��,<�
=�.2�.B�.U�.U�VZ�[e�Vf�hl�/V�/n�/n�+�	�8���,�?�$�F�2�2�02��u�
�5>�F�5�M�'�2��
�+�=�#�6�1�1�/1��t��4<�F�4�L��1���(�:�:�:�)0�F�:�&��v�-�-�+-��x�(�36�q�6�6�F�8�$�Z�0�0�0�0�0�0�����:����
����f�-�-�-�#�D��N��L�L�������e�*�*��w����w���!�"�		)��|�+�7�!#�� $�� <� C� C� E� E�4�4�H��'�'��h�x�.@�A�A�A�"�)�)�(�3�3�3�3�&4��{�#�#�&(��{�#�	
�����%�%�%��qsa�2(D�
E�%"E�E�E*�*
F2�44F-�-F2�)H6�6
I0�&I+�+I0�'CO+�+
P%�5&P � P%r�r?r|�returnc��|j���s d|d<d|�di��d<dS|j���s d|d<d|�di��d<dS	|j�|��\}}||d�|d<dS#t
$r6}d|d<t
|��|�di��d<Yd}~dSd}~wt$r}||j|j	d	�z}Yd}~dSd}~wwxYw)
z�
        Retrieve inodes limits for user

        :param int uid: user id
        :param dict limits: limits dict
        :param dict result: result dict
        r�r�z'LVE Manager/quota package not installedr�Nz#Quotas not activated on this systemrKrI)�warningr�)
rsr��
setdefault�is_clquota_activated�get_inodes_limits_by_uidrr;rr�r�)rxr�r?r|�
soft_limit�
hard_limitr�s       r4r�z#CloudlinuxLimits._get_inodes_limits�sN���~�0�0�2�2�	�%�F�7�O�7`�F���h��+�+�G�4��F��~�2�2�4�4�	�%�F�7�O�7\�F���h��+�+�G�4��F�	C�%)�^�%L�%L�S�%Q�%Q�"�J�
�(2�J�G�G�F�8�����%�	>�	>�	>�%�F�7�O�7:�1�v�v�F���h��+�+�G�4�4�4�4�4�4�4������	C�	C�	C��!�)��	�B�B�B�F�F�F�F�F�F�F�����	C���s$�4%B�
D�%+C�
D�#C;�;Dc�z�|j���sdddid�}t|���|j���\}}|tjkrdddid�}t|���|tjkr|�|j���tvrdSdddd	�d�}t|���)
a�
        Checks if the Governor limits can be retreived.

        After making sure that mysqlgov is installed and operational,
        checks that its mode is in [abusers single], user is reseller
        and resellers limits is OFF, or user belongs to admin.

        Only returns if it's True - otherwise constructs and throws MySQLGovException.
        Does it this way because these exceptions are caught in the web UI and displayed
        with optional localization.
        For localization of messages from here, see example:
        cpanel-lvemanager/spa/src/assets/i18n/hu-hu.json, key "Governor mode is not abusers or single"

        :raises MySQLGovException: Error from the Governor status check, or a constructed error
        for UI to display.
        :raises gov_error: If the Governor status check returned an error, reraises it here.
        :return: Whether it's possible to retrieve Governor limits in current state.
        :rtype: bool
        z%(util)s not present in system�util�Governor�r�r�z%(util)s is currently disabledTz%(util)s mode is not %(mode)szabusers or single)r�mode)	rtr�r�get_governor_statusr�DISABLED�ERROR�get_governor_mode�MYSQL_GOV_ENABLED_MODE)rx�exc_message�
gov_status�	gov_errors    r4r�z(CloudlinuxLimits.can_get_governor_limits�s���(�#�7�7�9�9�	1�;�"�J�/���K�$�K�0�0�0� $� 4� H� H� J� J��
�I���0�0�0�;�"�J�/���K�$�K�0�0�0���-�-�-��O���1�1�3�3�7M�M�M��4�7� *�4G�H�H�
�
�� ��,�,�,r3c��dD]5}||s+|�|d��r|�|���6|ds+|�dd��r|�d��|dsj|�dd��rT|d�dd��r8|d�d��|ds|�d��|dsl|�dd��rX|d�dd��r>|d�d��|ds|�d��d	Sd	Sd	Sd	Sd	S)
z�
        Remove limits that are stored as key: False in `keys` dict;
        Used for --limits key;
        :type keys: dict[str, bool]
        :type limits: dict[str, str | dict]
        )rUrYrSr[Fr_rQr\r6r7rCN)r��pop)rxrr?r�s    r4r�zCloudlinuxLimits._filter_limits(s���3�	�	�A���7�
�v�z�z�!�U�3�3�
��
�
�1�
�
�
���O�$�	����D�%�)@�)@�	��J�J�t�����G�}�	"����E�5�!9�!9�	"�f�U�m�>O�>O�PU�W\�>]�>]�	"��5�M���e�$�$�$��%�=�
"��
�
�5�!�!�!��D�z�	!�f�j�j��u�5�5�	!�&��,�:J�:J�5�RW�:X�:X�	!��4�L���U�#�#�#��$�<�
!��
�
�4� � � � � �	!�	!�	!�	!�	!�	!�
!�
!r3c��|���\}}|���|�||��S)z#
        Run `set` command
        )�_set_check_userr��_set_action)rxr�r�s   r4r�zCloudlinuxLimits._set_run=sA��
�,�,�.�.�
��X�����������X�.�.�.r3c�������\}}t�fd�dD����}|�|�|s��ddi��t�fd�tD����r$t�fd�tD����s||fS�jds��jd	�Zt
�jd	��s@t�jd	��s%��d
d�jd	id���n>��|��}t|��r��d
d|id���||fS)z&
        Find user for modify
        c3�2�K�|]}�j|V��dSrh�r��r��xrxs  �r4r�z3CloudlinuxLimits._set_check_user.<locals>.<genexpr>Ns)�����e�e�!��
�1�
�e�e�e�e�e�er3)�--mysql-unrestrict-allr�Nr|z1You must set lve-id or username for modify limitsc3�2�K�|]}�j|V��dSrhr"r#s  �r4r�z3CloudlinuxLimits._set_check_user.<locals>.<genexpr>Vs)�����9�9��t�z�!�}�9�9�9�9�9�9r3c3�8�K�|]}�jd|��V��dS�z--Nr"r#s  �r4r�z3CloudlinuxLimits._set_check_user.<locals>.<genexpr>Ws0�����H�H��t�z�(�q�(�(�+�H�H�H�H�H�Hr3r�r�z.Reseller limits for %(reseller)s are disabled.r�r�zYReseller limits for %(reseller)s are enabled. Admin can`t set limits for resellers users.)	r�r�r�r"r%r�rrr�)rxr�r��opts_without_userr�s`    r4rz CloudlinuxLimits._set_check_userHs�����(�(�*�*�
��X��e�e�e�e�7d�e�e�e�e�e���K�8�+�5F�+�� � �(�,_�!`�a�a�a��9�9�9�9�&8�9�9�9�9�9�	!��H�H�H�H�5G�H�H�H�H�H�	!���=� ��z�+�,�	��z�*�+�7����Td�Ie�@f�@f�7�0���<L�1M�N�N���(�(�"R�$.��
�;K�0L�#M�*�*�����
!%� 7� 7�� A� A�
�,�]�;�;���(�(�#P�$.�
�#>�*�*�����H�}�r3c��tdg��}t|zt|zt|zt|zd�|}tt|��|z��dkrt
t|��|z��SdS)z�
        Return keys to reset that are only acceptable to this type of limits
        :param list defaults: List of keys to reset
        :param str t: one of "lve", "cl-quota", "dbgov"
        r7)r �lvp�cl-quota�dbgovrN)r�r%r&r)r'r��list)�defaults�t�all_keyrs    r4�_clean_defaultsz CloudlinuxLimits._clean_defaultsks����u�g�,�,��%��/�%��/�,�w�6�)�G�3�	
�
�
�
���s�8�}�}�t�#�$�$�q�(�(���H�
�
��,�-�-�-��tr3c��|j}|dp|d}|sdSt|��s|�dd|id���dSdS)z�
        If any reseller is specified in cli options ensures that it exists
        and really a reseller. Will exit with error if not.
        r�r�NzNo such reseller: %(reseller)sr�r�)r�rr�)rxr�r�s   r4r�z!CloudlinuxLimits._verify_reseller}s��

�J���&�'�>�1�-=�+>���	��F��8�$�$�	�� � �:�&��1�"�"�
�
�
�
�
�	�	r3c	�D�|j}d}d}ttj��}|r1|dr)|ddkr|�||��\}}}	d}nI|ddu}d|d<|r|r|�||��\}}}	n|�|||��\}}}	|pdg}t
|��rtd�|D��d	��Sttj��r|dkr|j	�
��|�||||	|||��S)
zl
        Process set limits command
        :param uid: User uid
        :param username: User name
        Fr�r�rTr�Nc3�K�|]}|�|V��	dSrhr2)r��codes  r4r�z/CloudlinuxLimits._set_action.<locals>.<genexpr>�s'����;�;�$�d�;��;�;�;�;�;�;r3�*)r�r
r�RESELLER_LIMITS�_set_reseller_action�_set_user_actionr��nextrirq�apply_all_limits�_make_set_action_response)
rxr�r�r��action_with_reseller_container�set_default_resellers_limits�reseller_limits_supported�is_lvectl_error�ret_listr|s
          r4rzCloudlinuxLimits._set_action�st��
�J��).�&�',�$�$>�w�?V�$W�$W�!�$�
	\��+;�)<�
	\��:��RS�AS�AS�15�0I�0I�!�S�0Q�0Q�-�O�X�v�+/�(�(�-.�/@�-A��-M�*� �A�j�M�(�
\�-K�
\�48�4M�4M�a�QT�4U�4U�1���6�6�48�4I�4I�!�S�RZ�4[�4[�1���6��?��s���x�=�=�	A��;�;�(�;�;�;�R�@�@�@�%�g�k�2�2�	,�s�a�x�x�
�L�)�)�+�+�+��-�-�.L�.=�q�&�.J�.1�8�=�=�	=r3c�����|jstd��dS|�tj��dd���|ds|drI|sGd|j_t
tj��rd|j	_
|����n�d}d}	tt��}
|d�|d�%|j�|d	�
��\|d<|d<|���D]Q\}}|dd�}|r@|t"vr7d	}	|r|t$vrd	}t'|��}t(|}
|
|
|���R|	�r	|r�d|j	_
|r!|j	�|d���nW|r;|j	�|d
��}|d}|�|d}|d�n|j	�|���d����fd�|
���D��}
|�|��}|r|||
d�g}|�d|i��n'||dkrdn|||
d�g}|�d|i��|�|d	��dS)Nrzr)r}r|�	--default�--unlimitedF�--mysql-cpu�
--mysql-ioTr��r�r�r�r�r?c�`�t|t��r|�|��n|}|Srh)r~rr:)�	old_value�	new_values  r4�update_funcz?CloudlinuxLimits._make_set_action_response.<locals>.update_func�s6��%�i��6�6�2�%�,�,�Y�7�7�7�7�(1�I�(�(r3c�H��i|]\}}||�vr�|�|��n|��Sr2r2)r��keyr@�
getted_limitsrLs   ��r4�
<dictcomp>z>CloudlinuxLimits._make_set_action_response.<locals>.<dictcomp>�sV���%�%�%�'�C����-�/�/�)�[��
�c�0B�C�C�C�5:�%�%�%r3)r�r�r?r�r`rb)r�r�r�r?r�)r��printr:r�rs�_inode_user_limitsr
rrirqr�r�rrrtr�r�r#r%r;�
OUT_LIMITS�#get_default_limits_by_reseller_name�get_limits_by_reseller_namer�r�r�)rxr>rAr�r|r?r�r��
is_lve_limits�	is_limits�
setted_limitsrNr@�
value_func�getted_reseller_datar�r�r�rOrLs                  @@r4r=z*CloudlinuxLimits._make_set_action_response�s0�����}�	��)�����1��
�
������
�
�	�	�	�
�k�N�K	*�a�
�.�K	*��K	*�04�D�N�-�)�'�+�6�6�
2�-1���*��!�!�#�#�#�#�!�M��I�'��-�-�M����+�q���/J�59�4H�4[�4[�\d�nr�5\�5t�5t�1��-� �!�L�/��g�g�i�i�
5�
5�
��U��!�"�"�g���5�S�N�2�2� $�I��-��(:�!:�!:�(,�
���J�J�E�!+�C��J��J�}�e�4�4�4���1
4� ��15�D�L�.�3�T�)-��(X�(X�YZ�[k�Yl�(m�(m�
�
�9�	T�48�<�3[�3[�\]�^o�\p�3q�3q�0�';�F�'C�H�"�{�&:�4�&@��,@��,J�M�M�,0�L�,N�,N�s�,S�,S�M�)�)�)�%�%�%�%�%�+8�*=�*=�*?�*?�%�%�%�M�!%� 7� 7�� A� A�
�1�4�!� (�"/�"�"�!�I�
�M�M�;�	�":�;�;�;�;�#&�/7�6�/A�/A���x�(5�&3�	���E��M�M�7�E�"2�3�3�3��O�O�F�D�)�)�)��qr3c�f���d}g}i}�d}ttj��r�t�fd�tD����r�ddi�t��fd�tD����}��d��|d<	|j�|||��}	|�	|	��n9#t$r,}
|�|
j|
j
d	���Yd}
~
nd}
~
wwxYw�d
r�ttj��r_	|j�||��d}n)#tf$r}
d}|
j|
j
d	�}Yd}
~
nd}
~
wwxYw|rd|d
<i|d<||dd
<	|�|j�|��d}d}
n)#t"f$r}
d}|
j|
j
d	�}
Yd}
~
nd}
~
wwxYw|rd|d<d|vri|d<|
|dd<d}	|�	|	���d���ttj��rh	|��dd��}|�|j�||��d}d}n)#tf$r}
d}|
j|
j
d	�}Yd}
~
nd}
~
wwxYw|rd|d
<i|d<||dd
<�d��&	|��dd���|j�|��d}d}
n)#t"f$r}
d}|
j|
j
d	�}
Yd}
~
nd}
~
wwxYw|rd|d<d|vri|d<|
|dd<ttj��r�	|��dd��}|j���r|�|j�||��n9#t2f$r+}
d|vri|d<|
j|
j
d	�|dd<Yd}
~
nd}
~
wwxYwd}	|�	|	���dry	�ddk}|j�||��d}	|�	|	��n9#t8$r,}
|�|
j|
j
d	���Yd}
~
nd}
~
wwxYwttj���r�t�fd�t:D�����r�	|����r:�drw�ddk}	|j�||��}	|�	|	��n9#t2$r,}
|�|
j|
j
d	���Yd}
~
nd}
~
wwxYw�drw�ddk}	|j� ||��}	|�	|	��n9#t2$r,}
|�|
j|
j
d	���Yd}
~
nd}
~
wwxYw�dri	|j�!��}	|�	|	��n9#t2$r,}
|�|
j|
j
d	���Yd}
~
nd}
~
wwxYwt�fd�tDD����r��d�d }}|d!kr!|j�#d"��sd#}d#�d <	|j�$|d$krd%n|||��}	|�	|	��n9#t2$r,}
|�|
j|
j
d	���Yd}
~
nd}
~
wwxYwn9#t2$r,}
|�|
j|
j
d	���Yd}
~
nd}
~
wwxYw�d&r�	|j�%|�d&��dd���'��d}	|�	|	��n9#t"$r,}
|�|
j|
j
d	���Yd}
~
nd}
~
wwxYw|||fS)(NFr�c3�.�K�|]}�d|��V��dSr(r2�r��sr�s  �r4r�z4CloudlinuxLimits._set_user_action.<locals>.<genexpr>s-�����:c�:c�1�1�X�!�X�X�;�:c�:c�:c�:c�:c�:cr3r_�mepc3�p�K�|]0}�d|���
��||���d|��fV��1dSr()r�)r�r$�
limits_mapr�s  ��r4r�z4CloudlinuxLimits._set_user_action.<locals>.<genexpr>s_�����L�L�!�34�X�!�X�X�;�3J�&�>�>�!�Q�/�/��8��8�8��=�3J�3J�3J�3J�L�Lr3z--save-all-parameterszsave-all-parametersr�rETr��lvectlr�r�rrDr r,r-r�z--cagefsr�c3�.�K�|]}�d|��V��dSr(r2r]s  �r4r�z4CloudlinuxLimits._set_user_action.<locals>.<genexpr>�s.�����?n�?n�PQ��(�q�(�(��?n�?n�?n�?n�?n�?nr3z--mysql-gov�watchedz--mysql-restrict�
restrictedr%c3�.�K�|]}�d|��V��dSr(r2r]s  �r4r�z4CloudlinuxLimits._set_user_action.<locals>.<genexpr>�s-�����E�E�1�1�X�!�X�X�;�E�E�E�E�E�Er3rFrGr!z1.2-17rHr`�defaultz--inodes)�force)&r
rrir�r%rr�rq�set_lve_limits_by_user_idr�rr�r�r��set_lve_unlimitedrs� set_user_inodes_limits_unlimitedrr2�reset_lve_limits�reset_user_inodes_limits�GOVERNORrtr��reset_user_limits_to_defaultsrrr�set_user_statusrr(r��set_governor_status_for_user�set_restricted_status_for_user�%set_unrestricted_status_for_all_usersr'�_is_governor_newer_then�set_limits_for_user�set_user_inodes_limits)rxr�r�r�rArBr|r�r?�ret_coder��lvectl_error_dict�is_quota_error�quota_error_dict�lve_defaults�
gov_limits�new_user_status�str6rCras `                  @r4r:z!CloudlinuxLimits._set_user_actionsy
�����������*�+�
�%�g�k�2�2�	R�s�:c�:c�:c�:c�Pb�:c�:c�:c�7c�7c�	R�)�5�1�J��L�L�L�L�L�/�L�L�L�L�L�F�,-�E�E�2I�,J�,J�F�(�)�
R��<�A�A�#�v�}�]�]������)�)�)�)��"�
R�
R�
R��$�$��	�a�i�%P�%P�Q�Q�Q�Q�Q�Q�Q�Q�����
R����
�]��"	&�)�'�+�6�6�

C�T��L�2�2�3�
�F�F�F�(,�%�%��'�)�T�T�T�&*�O�34�9���(S�(S�%�%�%�%�%�%�����T����#�C�'.�F�8�$�')�F�8�$�1B�F�8�$�X�.�
O� �(��N�C�C�C�H�H�H�!&��#'� � ��$�&�
O�
O�
O�!%��./�i�A�I�#N�#N� � � � � � �����
O�����
=�")��w���6�)�)�')�F�8�$�,<��x� ��)��H��O�O�H�%�%�%��[�>�%�)�'�+�6�6�

T�	T�#'�#7�#7��+���#N�#N�L�#�/���5�5�c�<�H�H�H�&+�O�(,�%�%��'�)�T�T�T�&*�O�34�9���(S�(S�%�%�%�%�%�%�����T�����
?�#*��x� �#%��x� �->��x� ��*��!�"�*�S��+�+�A�k�N�J�G�G�S���?�?��D�D�D�%*�N�'+�$�$��(�*�S�S�S�%)�N�23�)��	�'R�'R�$�$�$�$�$�$�����S����"�A�&-�F�7�O��v�-�-�+-��x�(�0@�F�8�$�W�-�.�g�.>�?�?�c�c�%)�%9�%9�!�K�.�'�%R�%R�
��/�C�C�E�E�e�*�J`� �0�N�N�x�Yc�d�d�d���-�0�c�c�c�#�6�1�1�/1�F�8�,�BC�)�XY�Xa�7b�7b��x�(��4�4�4�4�4�4�����c�����H��O�O�H�%�%�%��Z�=�	R�
R�"#�J�-�9�"<����,�,�X��G�G�G�������)�)�)�)��"�
R�
R�
R��$�$��	�a�i�%P�%P�Q�Q�Q�Q�Q�Q�Q�Q�����
R����%�g�&6�7�7�,	R�C�?n�?n�?n�?n�Um�?n�?n�?n�<n�<n�,	R�+
R��/�/�1�1�(^���'�^��}�-��:��^�'+�';�'X�'X�Ya�ce�'f�'f�H�$�O�O�H�5�5�5�5��0�^�^�^� �0�0�A�I�RS�R[�1\�1\�]�]�]�]�]�]�]�]�����^�����+�,�^��1�2�l�B��^�'+�';�'Z�'Z�[c�eg�'h�'h�H�$�O�O�H�5�5�5�5��0�^�^�^� �0�0�A�I�RS�R[�1\�1\�]�]�]�]�]�]�]�]�����^�����1�2�^�^�'+�';�'a�'a�'c�'c�H�$�O�O�H�5�5�5�5��0�^�^�^� �0�0�A�I�RS�R[�1\�1\�]�]�]�]�]�]�]�]�����^�����E�E�E�E�0D�E�E�E�E�E�^�"#�M�"2�A�l�O�R��
��7�7�4�+?�+W�+W�X`�+a�+a�7�!"�B�./�A�l�O�^�'+�';�'O�'O�-5��-?�-?�	�	�X�s�TV�(�(�H�%�O�O�H�5�5�5�5��0�^�^�^� �0�0�A�I�RS�R[�1\�1\�]�]�]�]�]�]�]�]�����^������$�
R�
R�
R��$�$��	�a�i�%P�%P�Q�Q�Q�Q�Q�Q�Q�Q�����
R����
�Z�=�	R�
R���5�5���:��a�e�e�4K�U�.S�.S�6����������)�)�)�)��#�
R�
R�
R��$�$��	�a�i�%P�%P�Q�Q�Q�Q�Q�Q�Q�Q�����
R������&�0�0s��1B:�:
C0�"C+�+C0�D3�3E�>E�E�4 F�F;� F6�6F;�=I�I7�I2�2I7�:K�K<�!K7�7K<�4AN�N=�!N8�8N=� >P�
Q�)"Q�Q�)[$�>0S/�.[$�/
T%�9"T �[$� T%�%[$�=0U.�-[$�.
V$�8"V�[$�V$�$[$�0.W�[$�
X�)"X�[$�X�A[$�09Z*�)[$�*
[ �4"[�[$�[ � [$�$
\�."\�\�&A]5�5
^+�?"^&�&^+c�D���d}i}g}t�fd�tD����r�ddi�t��fd�tD����}	�jd�'�j��jd|��}n&�j��jd|��}|�|��n9#t$r,}��	|j
|jd	���Yd}~nd}~wwxYw|d
��	��|d
d��}	|	�6�j�
|d|	��}|�|��d}d}
n)#tf$r}d}|j
|jd	�}
Yd}~nd}~wwxYw|rd
|d<i|d<|
|dd<|dr{	�j�|d��d}
n)#tf$r}d}|j
|jd	�}
Yd}~nd}~wwxYw|rd
|d<i|d<|
|dd<d}|�|��|||fS)NFc3�8�K�|]}�jd|��V��dSr(r")r�r^rxs  �r4r�z8CloudlinuxLimits._set_reseller_action.<locals>.<genexpr>�s0�����@�@��t�z�(�q�(�(�#�@�@�@�@�@�@r3r_r_c3��K�|]:}�jd|�����||���jd|��fV��;dSr()r�r�)r�r$rarxs  ��r4r�z8CloudlinuxLimits._set_reseller_action.<locals>.<genexpr>�se�����U�U�1�37�:�h�1�h�h�3G�3S�&�>�>�!�Q�/�/���H��H�H�1E�F�3S�3S�3S�3S�U�Ur3r�r�r�r�rDr+Tr�rbr�rEr)r�r&rr�rq�set_lvp_defaults_by_reseller_id�set_lvp_limits_by_reseller_idr�rr�r�r�r2�reset_reseller_limits�set_lvp_unlimited)rxr�r�rAr|rBr?rwr�r{rxras`          @r4r9z%CloudlinuxLimits._set_reseller_action�s�����������@�@�@�@�-?�@�@�@�@�@�	R�)�5�1�J��U�U�U�U�U�/�U�U�U�U�U�F�
R��:�j�)�5� $�|�K�K�D�J�Wg�Lh�jp�q�q�H�H� $�|�I�I�$�*�Uf�Jg�io�p�p�H�����)�)�)�)��"�
R�
R�
R��$�$��	�a�i�%P�%P�Q�Q�Q�Q�Q�Q�Q�Q�����
R����
�[�>�%�

P�#�3�3�A�k�N�E�J�J���+�#�|�A�A�!�DU�BV�Xd�e�e�H��O�O�H�-�-�-�"'��$(�!�!��#�%�
P�
P�
P�"&��/0�y�Q�Y�$O�$O�!�!�!�!�!�!�����
P�����
?�#*��x� �#%��x� �->��x� ��*��]��	&�
P���.�.�q�1B�/C�D�D�D�$(�!�!��#�%�
P�
P�
P�"&��/0�y�Q�Y�$O�$O�!�!�!�!�!�!�����
P�����
?�#*��x� �#%��x� �->��x� ��*��H��O�O�H�%�%�%���&�0�0sJ�A/B?�?
C5�	"C0�0C5�AE�F�%E;�;F�#"G�G,�G'�'G,c��td���}td�|D����|_td�|D����|_dS)N)�cploginr��dns)�keylsc3�6K�|]}|d|dfV��dS)rr!Nr2�r��is  r4r�z/CloudlinuxLimits._init_cache.<locals>.<genexpr>��.����&B�&B���!��a��d�|�&B�&B�&B�&B�&B�&Br3c3�6K�|]}|d|dfV��dS)rrHNr2r�s  r4r�z/CloudlinuxLimits._init_cache.<locals>.<genexpr>�r�r3)rr�_user_to_reseller�_userdomain_cache)rx�infos  r4�_init_cachezCloudlinuxLimits._init_cache�sW���:�;�;�;��!%�&B�&B�T�&B�&B�&B�!C�!C���!%�&B�&B�T�&B�&B�&B�!C�!C����r3c��|j�-	|���n#t$r
i|_YnwxYw|j�|d��}|S)zi
        Try to get reseller for given username;
        :type username: str
        :rtype: str
        Nrb)r�r�rr�)rxr�r�s   r4r�z#CloudlinuxLimits._get_reseller_name�sn���!�)�
,�� � �"�"�"�"���
,�
,�
,�)+��&�&�&�
,�����.�2�2�8�S�A�A�
�����2�2c��|j�-	|���n#t$r
i|_YnwxYw|j�|d��S)z~
        Retrive main domain for supplied user
        :param username: User name
        :return: Domain name or N/A
        Nr�)r�r�rr�r�s  r4r�z CloudlinuxLimits.get_user_domainsi���!�)�
,�� � �"�"�"�"���
,�
,�
,�)+��&�&�&�
,�����%�)�)�(�E�:�:�:r�c��	t|��}|r|Sn6#ttf$r"}tt	|����|�d}~wwxYwtdd|id����)zn
        Retrive username by domain
        :param domain_name: Domain name
        :return: Username
        NzThere is no domain '%(domain)s'r�r)r	�IOErrorrr.r;)rx�domain_namer�r�s    r4r�z(CloudlinuxLimits.get_user_name_by_domains���	1�#�K�0�0�H��
 ���
 ����&�	1�	1�	1�!�#�a�&�&�)�)�q�0�����	1�����*K�+3�[�*A�C�C�D�D�	Ds��A	�A�A	c��|j}d\}}d�}|ds|ddkri|d}|�|��}t|��}|s0t|��r!d�}|�||����||j|<n�|dr�|d}	|j�|��}n>#tj	$r,}|�|j
|jd���Yd}~nd}~wwxYw|�|��}|s-t|��r|�||����||j|<||fS)	a
        User identification from CLI options. Common for all commands.
        May return (None, None) when user wasn't specified in any way and this
        is a *valid* case when we want to list all users with command like:
        "... get --json --for-reseller=reseller1"
        )NNc��dd|id�S)Nr�r�r�r2)r�s r4�_username_messagez7CloudlinuxLimits._check_user.<locals>._username_message-s��@�j�Zb�Mc�d�d�dr3r�rc��dd|id�S)Nz%(uid)s is not a panel userr�r�r2)r�s r4�_uid_messagez2CloudlinuxLimits._check_user.<locals>._uid_message8s��&C�QV�X[�P\�]�]�]r3r�r�N)r�r�r
r�r�rvrpr�rr�r�r�)rxr�r�r�r��user_packager�r�s        r4r�zCloudlinuxLimits._check_user#s���
�J��"�
��X�	e�	e�	e�
�Z�=�	-�A�j�M�Q�.�.��J�-�C��;�;�C�@�@�L�/��4�4�H� �
8�D��I�I�
8�^�^�^��$�$�\�\�#�%6�%6�7�7�7�$,�D��S�!�!�
�|�_�	-����H�
R��k�)�)�(�3�3�����,�
R�
R�
R��$�$��	�a�i�%P�%P�Q�Q�Q�Q�Q�Q�Q�Q�����
R�����;�;�C�@�@�L��
B�D��I�I�
B��$�$�%6�%6�x�%@�%@�A�A�A�$,�D��S�!��H�}�s�B9�9C4�"C/�/C4r!c�~�|jr9|�dtj��i��t|d��nh	t	t|d��|�di��z��n-#t$r }t	d|�d|�d���Yd}~nd}~wwxYwtj	|��dS)	z�
        Print error and exit

        :param message dict: Dictionary with keys "result" as string and optional "context" as dict
        r}Tr|r�zError: z [�]N)
r�r:r�rrQr;r��KeyError�sys�exit)rxr��
error_coder�s    r4r�z CloudlinuxLimits._error_and_exitMs����=�	1��N�N�K�����5�6�6�6��W�d�+�+�+�+�
1��c�'�(�+�,�,�w�{�{�9�b�/I�/I�I�J�J�J�J���
1�
1�
1��/��/�/�W�/�/�/�0�0�0�0�0�0�0�0�����
1�����������s�9A<�<
B&�B!�!B&)Frz)r!).r/r0r1�__doc__r�r�r�rvr�r�rlryr�r�r�r�r�r�r�r�r�r�r�rr�r�r<r�r�r�r�r�staticmethodr2r�rr=r:r9r�r�r�r�r�r��
__classcell__)rns@r4rfrfBs����������
�E��H����K�����$�$�$�$�$�

�
�
�	<�	<�	<�	<�"H�"H�"H�H������@
'�
'�
'�	N�	N�	N�
N�
N�
N�8�8�8�t=�=�=����4����$�����*A�A�A�FC�c�C�4�C��C�$�C�C�C�C�6,-�,-�,-�\!�!�!�*	/�	/�	/�!�!�!�F����\��"
�
�
�'=�'=�'=�RX�X�X�tj1�j1�j1�X71�71�71�rD�D�D�
���;�;�;�
D�
D�
D�(�(�(�T�������r3rfc� �eZdZd�Zd�Zd�ZdS)rkc��t��|_t��|_t	��|_t
��|_i|_dSrh)	rrprrrrrsr*rurvrws r4ryzCloudlinuxLimitsNoLve.__init__`s?���g�g����x�x���#�����;�=�=�������r3c�v�ddlm}	t||��d��}n#t$rd}YnwxYw|S)z�
        Get package name by user id.
        None package returns as str(None) for user checker compatibility:
          'not str(None)' is True
        :param: id - user/lve id
        :return: Package name
        r)�reseller_package_by_uidr!r�)�clcommon.cpapir�r;�
IndexError)rxr�r��package_names    r4r�z1CloudlinuxLimitsNoLve.get_package_name_by_user_idgsg��	;�:�:�:�:�:�	��6�6�s�;�;�A�>�?�?�L�L���	�	�	��L�L�L�	�����s�'�6�6c���i}|j}|j���rd|d<nd|d<|d�$|j���rd|d<nd|d<t|dt��r|d�d��nd�t�fd	�tD����}g}|j
���D�]\}}|�||��}|d
r�|j���rh	|j�
|d��}|rdnd|d<n=#t$r0}	d|d<d
|vri|d
<t
|	��|d
d<Yd}	~	nd}	~	wwxYw|�|��|d<i}
|d�|dr|�||
|��|
|d<|�|����t%|��|d<||d<|dsg|d<|�|d��dS)r�r�r�r�r�Nr�r�rJc3�*�K�|]
}|�p|�vfV��dSrhr2r�s  �r4r�z9CloudlinuxLimitsNoLve._get_action_list.<locals>.<genexpr>�r�r3r�r�r�r�r�rIr?r�r�r�Tr)r�rrr�rsr�r~r;rNrr$rvr�r�r�rr�r�r�r�r�)rxr|r�rr�r�r�r�rr�r?r�s           @r4r�z&CloudlinuxLimitsNoLve._get_action_listwsr���
���J���<�)�)�+�+�	*�(�F�8���)�F�8���
��&��~�0�0�2�2�
-�"+��w���",��w��)3�A�j�M�3�)G�)G�
Q�Q�z�]�
 �
 ��
%�
%�
%�T���E�E�E�E�4D�E�E�E�E�E����!�-�3�3�5�5�	�	�M�C���5�5�c�8�D�D�D��H�~�

8�$�,�"@�"@�"B�"B�

8�8�$(�L�$@�$@��j�AQ�$R�$R�M�2?�%O�Y�Y�Z�D��N�N��&�8�8�8�'.�F�8�$��v�-�-�+-��x�(�14�Q���F�8�$�X�.�.�.�.�.�.�����8����#�>�>�s�C�C�D��O��F��!�"�*�t�H�~�*��'�'��V�V�<�<�<�#�D��N��L�L�������e�*�*��w����w���!�"�	%�"$�F�;��	
�����%�%�%��qs�)D6�6
E0�&E+�+E0N)r/r0r1ryr�r�r2r3r4rkrk^sA������������ :�:�:�:�:r3rk)>r�r��collectionsr�clcommonr�clcommon.clexceptionrr�rrrr	r
rrr
rr�clcommon.cpapi.cpapiexceptionsr�clcommon.librrr�	cli_utilsrr�	cllicenser�cllimitsrrrr�cllimits.clquota_librrr�	lvectllibrrr �arg_parsersr"r#r$r%r&r'r(r)r*r+�utilsr,r.rS�ADMIN_RESELLER_NAMESrrfrkr2r3r4�<module>r�s5���
�
�
�����#�#�#�#�#�#�������3�3�3�3�3�3�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�9�8�8�8�8�8�I�I�I�I�I�I�I�I�I�I�6�6�6�6�6�6�6�6�*�*�*�*�*�*�E�E�E�E�E�E�E�E�E�E�E�E�:�:�:�:�:�:�:�:�:�:�N�N�N�N�N�N�N�N�N�N�6�6�6�6�6�6�6�6�6�6�6�6�6�6�6�6�6�6�6�6�6�6�6�6�.�-�-�-�-�-�	�	�	�	�	�(�	�	�	�
��
D�
C�M�M�K�K���H�G�
B�
B�
?�
?�
?�
?�@�@�'��
�,.�-�-��#�X�.��Y�Y�Y�Y�Y�Y�Y�Y�x S�S�S�S�S�,�S�S�S�S�Sr3

Hacked By AnonymousFox1.0, Coded By AnonymousFox