Submit
Path:
~
/
/
opt
/
cloudlinux
/
venv
/
lib64
/
python3.11
/
site-packages
/
clwizard
/
modules
/
__pycache__
/
File Content:
governor.cpython-311.opt-1.pyc
� ܨf? � � � d dl mZ d dlZd dlmZmZ d dlmZ d dlm Z d dl mZmZ d dl mZ d dlmZ d d lmZ d d lmZmZ ddlmZ G d � de� � ZdS )� )�absolute_importN)�Dict�List)�Feature)� MySQLGovernor)�ExternalProgramFailed�run_command)� MysqlInfo)� getCPName)�MODULES_LOGS_DIR)�InstallationFailedException�UserInterventionNeededError� )�WizardInstallerc � � � e Zd Zej � ed� � ZdZdZ e j Z� fd�Z d� Zd� Zd� Zd� Zd � Zd � Zd� Zd� Zd � Z� xZS )�GovernorInstallerzgovernor.log�unknownz*/usr/share/lve/dbgovernor/mysqlgovernor.pyc � �� t t | � � � � � t � � � � � | _ d S )N)�superr �__init__r �get�db_info)�self� __class__s ��py/clwizard/modules/governor.pyr zGovernorInstaller.__init__ s; �� � ���&�&�/�/�1�1�1� !�{�{���(�(����� c �^ � | � d� � s} | � d� � }nI# t $ r<}| j � dt |� � � � t � � |�d }~ww xY w| j � d|� � d S | j � d� � d S )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 � � | j d t j k s| j d t j k rd S | j d � � � }d� | j d � d� � d � d� � dd� � � }||z S # t $ r Y d S w xY w)N�vendor�version� �-r �.� )r r �UNKNOWN�lower�join�split� IndexError)r r( r) s r �_prepare_db_optionsz%GovernorInstaller._prepare_db_options5 s� � ��L��"�&7�&?�?�?��|�I�&�*;�*C�C�C��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 �A7B2 �2 C �?C c �� � | j � d� � | � t j ddgd�� � dS # t $ r}t � � |�d}~ww xY w)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)r r# �!_run_cmd_and_check_special_statusr �UTILITY_PATHr r )r r% s r �_initialize_governorz&GovernorInstaller._initialize_governorD s� � � 9��O� � �!9�:�:�:� �2�2�"�/��j�I�WX� 3� � � � � �� %� 9� 9� 9�-�/�/�S�8����� 9���s �>A � A �A�A c �$ � t |d�� � \ }}}||k rC| j � d� � | j � d|� � t � � �|dk r+| 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: %sr z2Error occurred during running "%s" Reason is: "%s"N)r r �warningr r! r )r �cmdr6 �retcoder$ �_s r r7 z3GovernorInstaller._run_cmd_and_check_special_statusT s� � � &�c�d�C�C�C����a��k�!�!��O�#�#�$J�K�K�K��O�#�#�L�#�6�6�6�-�/�/�/� ��\�\��O�!�!�"W�Y\�^a�b�b�b�'��,�,�,� �\r c � � | j d �t d� � �| � � � | � � � d S )Nr( z%Please, install a MySQL server first.)r r r&