PATH:
usr
/
share
/
lve
/
dbgovernor
/
modules
/
__pycache__
/
Editing: cpanel.cpython-311.pyc
� N��hp^ � �� � d Z ddlZddlZddlZddlZddlZddlZddlZddl Zddl Z ddlmZm Z mZmZmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZ G d� de� � ZdS )zC This module contains class for managing governor on cPanel server � N)�exec_command_out�grep�add_line�service�remove_lines� write_file� replace_lines�touch�is_package_installed�remove_packages�exec_command�parse_rpm_name�service_symlink�bcolors� get_cl_num� is_ubuntu� )�InstallManagerc � � � e Zd ZdZd� Zd� Zed� � � Zd� Zd� Z d� Z d� Zd � Zd � Z ed� � � Zd� Zd � Zd� Zd� Zd� Zd� Zd� Zd� Zed� � � Zd� Zd� Zd� Zd� fd� Zedd�� � Zed� � � Zed� � � Z� xZS ) � cPanelManagerz) Installation manager for cPanel c � � | � d� � dS # t $ r-}| � t |� � � � Y d}~dS d}~ww xY w)z5 Update user mapping file for cPanel �dbgovernor_mapN)�_script_subprocess�RuntimeError�warning�str)�self�es �+/usr/share/lve/dbgovernor/modules/cpanel.py�update_user_map_filez"cPanelManager.update_user_map_file sk � � !��#�#�$4�5�5�5�5�5��� !� !� !��L�L��Q��� � � � � � � � � ����� !���s � � A�"A�Ac � � d|v r�| � |� � }t t j d� |�� � � � � � t t j d� |�� � � � � � t t j d� ||� d� � d �� � � � � � n!t t j |� � � � t j d� � d S ) a Warn user in case of errors during dbgovernor_map process and exit with exitcode 1. If CpuserNotInMap Exception occurred, advice user to run rebuild_dbmap script Otherwise, just show original exception :param orig_msg: original exception text �CpuserNotInMapz5cPanel user `{u}` does not exist in the database map.)�uz�Try to perform the following command: /scripts/rebuild_dbmap {u} and then run /usr/share/lve/dbgovernor/mysqlgovernor.py --dbupdate again.zRIf this does not help, please, contact cPanel support with the original error: {m}� r )r# �mN) �retrieve_username�printr �fail�format�infor �split�sys�exit)r �orig_msg�usernames r r zcPanelManager.warning) s � � �x�'�'��-�-�h�7�7�H��'�,�V�]�]�`h�]�i�i�j�j�k�k�k��'�,� k�kq�kq�t|�kq�k}�k}�� � @� @� @��'�/� #Y�Y_�Y_�bj�bj�bp�bp�qu�bv�bv�wx�by� Z`� Z{� Z{�|� |� }� }� }� }� �'�,�x�(�(�)�)�)��������� c �\ � t j d| � � d S # t $ r Y dS w xY w)z� Try to get corrupted user name from the exception text (e.g. CpuserNotInMap Exception) :param msg: original exception text :return: username if retrieved, None otherwise u: cPanel user “(.+)” does not exist in the database map.r N)�re�findall� IndexError)�msgs r r&