Hacked By AnonymousFox

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

�

���f����ddlZddlmZmZddlmZddlmZddlm	Z	m
Z
ddlmZddl
mZddlmZdd	lmZmZd
dlmZGd�d
e��ZdS)�N)�Dict�List)�Feature)�
MySQLGovernor)�ExternalProgramFailed�run_command)�	MysqlInfo)�	getCPName)�MODULES_LOGS_DIR)�InstallationFailedException�UserInterventionNeededError�)�WizardInstallerc���eZdZej�ed��ZdZdZ	e
jZ�fd�Z
d�Zd�Zd�Zd�Zd	�Zd
�Zd�Zd�Zd
�Z�xZS)�GovernorInstallerzgovernor.log�unknownz*/usr/share/lve/dbgovernor/mysqlgovernor.pyc���t�����t�����|_dS)N)�super�__init__r	�get�db_info)�self�	__class__s ��P/opt/cloudlinux/venv/lib64/python3.11/site-packages/clwizard/modules/governor.pyrzGovernorInstaller.__init__s4���
��������!�{�{���(�(�����c�^�|�d��s}	|�d��}nI#t$r<}|j�dt|����t
��|�d}~wwxYw|j�d|��dS|j�d��dS)Nzgovernor-mysqlz*Package installation failed with error: %sz&Package was installed successfully: %sz=Skip the governor-mysql installation, it is already installed)�_is_package_installed�_install_packager�
app_logger�error�strr�info)r�out�errs   r�_install_governor_packagez+GovernorInstaller._install_governor_package's����)�)�*:�;�;�	b�
=��+�+�,<�=�=����(�
=�
=�
=���%�%�&R�TW�X[�T\�T\�]�]�]�1�3�3��<�����
=����
�O� � �!I�3�O�O�O�O�O��O� � �!`�a�a�a�a�as�-�
A3�7A.�.A3c�f�tj|jd|jdfvrdS	|jd���}d�|jd�d��d�d��dd���}||zS#t$rYdSwxYw)N�vendor�version��-r�.�)r�UNKNOWNr�lower�join�split�
IndexError)rr'r(s   r�_prepare_db_optionsz%GovernorInstaller._prepare_db_options2s����$���h�)?���i�AX�(Y�Y�Y��4�	��\�(�+�1�1�3�3�F��g�g�d�l�9�5�;�;�C�@�@��C�I�I�#�N�N�q�QR�s�S�T�T�G��G�#�#���	�	�	��4�4�	���s�A7B"�"
B0�/B0c���	|j�d��|�tjddgd���dS#t
$r}t
��|�d}~wwxYw)z�
        Trying to install governor with --wizard key, it detects the DB
        automatically (on DA and cPanel), for other panels we will have blockers
        for the governor module.
        zInstall MySQL Governorz	--installz--wizard�)�exit_statusN)rr"�!_run_cmd_and_check_special_statusr�UTILITY_PATHrr)rr$s  r�_initialize_governorz&GovernorInstaller._initialize_governor>s���	9��O� � �!9�:�:�:�
�2�2�"�/��j�I�WX�
3�
�
�
�
�
��%�	9�	9�	9�-�/�/�S�8�����	9���s�>A�
A �A�A c�$�t|d���\}}}||krC|j�d��|j�d|��t���|dkr+|j�d||��t|���dS)z�
        There are cases when some commands can't be executed without the user's
        intervention. Such scripts/commands return a special exit code that must
        be checked for.
        T)�return_full_outputz$Can`t install governor automaticallyz
Reason: %srz2Error occurred during running "%s"
Reason is: "%s"N)rr�warningr
r r)r�cmdr5�retcoder#�_s      rr6z3GovernorInstaller._run_cmd_and_check_special_statusNs���&�c�d�C�C�C����a��k�!�!��O�#�#�$J�K�K�K��O�#�#�L�#�6�6�6�-�/�/�/��a�<�<��O�!�!�"W�Y\�^a�b�b�b�'��,�,�,��<rc��|jd�td���|���|���dS)Nr'z%Please, install a MySQL server first.)rrr%r8)r�optionss  r�run_installationz"GovernorInstaller.run_installation]sH���<��!�)�-�.U�V�V�V��&�&�(�(�(��!�!�#�#�#�#�#rc�^�ddig}|jd�|�dddid���|S)	zh
        Get list of warnings that should be shown in wizard
        before module installation
        �messagez�Please create a full database backup (including system tables). MySQL/MariaDB/Percona server will be updated from CloudLinux repositories.r'NzUCould not detect a MySQL server. For a list of compatible options please see %(url)s.�urlz<https://docs.cloudlinux.com/mysql_governor_installation.html�rC�context)r�append)r�warningss  r�
_get_warningszGovernorInstaller._get_warningscsb���b�
�
���<��!�)��O�O�P��]� ���

�

�

��rc�^�g}t��dvr|�dddid���|S)zZ
        Get a list of possible blockers to disable Governor module in Wizard UI.
        )�cPanel�DirectAdminzMySQL Governor can't be automatically installed. Please install it through the command-line interface. Learn more here: %(url)srDz4https://docs.cloudlinux.com/installation-wizard.htmlrE)r
rG)r�blockerss  r�
_get_blockerszGovernorInstaller._get_blockerssR��
���;�;�7�7�7��O�O� 0��U� �	��	
�	
�	
��rc�`�t��}|���o|jdS)z:
        Check if the governor is ready for work.
        zcll-lve)r�is_governor_presentr)r�	mysql_govs  r�_is_already_configuredz(GovernorInstaller._is_already_configured�s+��"�O�O�	��,�,�.�.�J�4�<�	�3J�Jrc��|���|jdd�}|���}|r|�d|i��|���}|r|�d|i��|S)Nr()�already_configured�
db_versionrHrM)rRrrI�updaterN)r�resultrHrMs    r�initial_statusz GovernorInstaller.initial_status�s���"&�"=�"=�"?�"?��,�y�1�
�
���%�%�'�'���	2��M�M�:�x�0�1�1�1��%�%�'�'���	2��M�M�:�x�0�1�1�1��
r)�__name__�
__module__�__qualname__�os�pathr/r�LOG_FILEr-r7r�GOVERNOR�_REQUIRED_CL_COMPONENT_SUPPORTrr%r2r8r6rArIrNrRrX�
__classcell__)rs@rrrs���������w�|�|�,�n�=�=�H��G�?�L�%,�%5�"�	)�	)�	)�	)�	)�	b�	b�	b�
�
�
�9�9�9� 
-�
-�
-�$�$�$����8���&K�K�K�������rr)r\�typingrr�clcommon.constr�clcommon.lib.mysql_governor_libr�clcommon.utilsrr�clconfig.db_info_libr	�cldetectlibr
�clwizard.constantsr�clwizard.exceptionsrr
�baserr�rr�<module>rls��
�	�	�	���������"�"�"�"�"�"�9�9�9�9�9�9�=�=�=�=�=�=�=�=�*�*�*�*�*�*�!�!�!�!�!�!�/�/�/�/�/�/�X�X�X�X�X�X�X�X�!�!�!�!�!�!�N�N�N�N�N��N�N�N�N�Nr

Hacked By AnonymousFox1.0, Coded By AnonymousFox