%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python37/lib/python3.7/site-packages/clwizard/modules/__pycache__/
Upload File :
Create Path :
Current File : //opt/alt/python37/lib/python3.7/site-packages/clwizard/modules/__pycache__/governor.cpython-37.pyc

B

�2Lb��@s�ddlmZddlZddlmZmZddlmZmZddl	m
Z
ddlmZddl
mZddlmZdd	lmZmZd
dlmZddlmZGd
d�de�ZdS)�)�absolute_importN)�Dict�List)�run_command�ExternalProgramFailed)�	MysqlInfo)�
MySQLGovernor)�	getCPName)�MODULES_LOGS_DIR)�InstallationFailedException�UserInterventionNeededError�)�WizardInstaller)�Featurecs�eZdZej�ed�ZdZdZ	e
jZ�fdd�Z
dd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Zdd�Zdd�Z�ZS)�GovernorInstallerzgovernor.log�unknownz*/usr/share/lve/dbgovernor/mysqlgovernor.pycstt|���t���|_dS)N)�superr�__init__r�get�db_info)�self)�	__class__��J/opt/alt/python37/lib/python3.7/site-packages/clwizard/modules/governor.pyrszGovernorInstaller.__init__c
Cst|�d�sdy|�d�}Wn:tk
rR}z|j�dt|��t��Wdd}~XYnX|j�d|�n|j�d�dS)Nzgovernor-mysqlzYum failed with error: %sz*Yum package was installed successfully: %sz9Skip governor-mysql installation, it is already installed)Z_is_package_installedZ_install_yum_packager�
app_logger�error�strr�info)r�out�errr�_install_governor_package)s
z+GovernorInstaller._install_governor_packagecCs||jdtjks |jdtjkr$dSy>|jd��}d�|jd�d�d�d�dd��}||Stk
rvdSXdS)N�vendor�version��-r�.�)rr�UNKNOWN�lower�join�split�
IndexError)rr!r"rrr�_prepare_db_options4s (z%GovernorInstaller._prepare_db_optionscCsFy&|j�d�|jtjddgdd�Wntk
r@t��YnXdS)z�
        Trying to install governor with --wizard key, it detects DB automatically
        (on DA and cPanel), for other panels we will have blockers
        for governor module.
        zInstall governorz	--installz--wizard�)�exit_statusN)rr�!_run_cmd_and_check_special_statusr�UTILITY_PATHrr)rrrr�_initialize_governor@s
z&GovernorInstaller._initialize_governorcCs`t|dd�\}}}||kr<|j�d�|j�d|�t��n |dkr\|j�d||�t|��dS)z�
        There is cases when some command can`t be executed without user`s intervention
        Such scripts/commands returns special exit code, that must be checked
        T)Zreturn_full_outputz$Can`t install governor automaticallyz
Reason: %srz2Error occurred during running "%s"
Reason is: "%s"N)rrZwarningrrr)r�cmdr.Zrcr�_rrrr/Osz3GovernorInstaller._run_cmd_and_check_special_statuscCs*|jddkrtd��|��|��dS)Nr!z%Please, install a MySQL server first.)rrr r1)rZoptionsrrr�run_installation]sz"GovernorInstaller.run_installationcCs0ddig}|jddkr,|�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!NzQCould not detect MySQL server. For list of compatible options please see %(url)s.�urlz<https://docs.cloudlinux.com/mysql_governor_installation.html)r5�context)r�append)r�warningsrrr�
_get_warningscszGovernorInstaller._get_warningscCs&g}t�dkr"|�dddid��|S)zZ
        Get a list of possible blockers to disable Governor module in Wizard UI.
        )ZcPanelZDirectAdminz|MySQL Governor can't be automatically installed. Please install it with the command-line interface. Learn more here: %(url)sr6z4https://docs.cloudlinux.com/installation-wizard.html)r5r7)r	r8)r�blockersrrr�
_get_blockers}s
zGovernorInstaller._get_blockerscCst�}|��o|jdS)z:
        Check if the governor is ready for work.
        zcll-lve)rZis_governor_presentr)rZ	mysql_govrrr�_is_already_configured�sz(GovernorInstaller._is_already_configuredcCsL|��|jdd�}|��}|r.|�d|i�|��}|rH|�d|i�|S)Nr")Zalready_configuredZ
db_versionr9r;)r=rr:�updater<)r�resultr9r;rrr�initial_status�sz GovernorInstaller.initial_status)�__name__�
__module__�__qualname__�os�pathr)r
ZLOG_FILEr'r0rZGOVERNORZ_REQUIRED_CL_COMPONENT_SUPPORTrr r,r1r/r4r:r<r=r@�
__classcell__rr)rrrsr)Z
__future__rrD�typingrrZclcommon.utilsrrZclconfig.db_info_librZclcommon.lib.mysql_governor_librZcldetectlibr	Zclwizard.constantsr
Zclwizard.exceptionsrr�baserZclcommon.constrrrrrr�<module>	s

Zerion Mini Shell 1.0