관리-도구
편집 파일: __init__.cpython-311.pyc
� P�Cg+: � � � d Z ddlZddlmZ ddlmZmZ ddlmZm Z m Z ddlmZm Z mZmZmZmZmZmZmZ ddlmZmZ dd lmZmZmZ e � � \ ZZd � Zd:d�Zd:d �Z d� Z!d� Z"d� Z#d� Z$d� Z%d� Z&d;d�Z' d<d�Z(d� Z)d� Z*d� Z+d� Z,d� Z-d� Z.d� Z/d� Z0d=d �Z1d!� Z2d"� Z3d#� Z4d$� Z5d%� Z6d&� Z7d'ed(e8fd)�Z9d*� Z:d+� Z;d,� Z<d-e=d(e>fd.�Z?d/� Z@d0� ZAd1� ZBd2� ZC e� � d3� � � ZDd4� ZEd(e=fd5�ZFd6� ZGd7� ZHd8� ZId(e8fd9�ZJ ee� � ZKeK�L � � ZM e!� � ZNeMjO ZOeMjP ZPeMjQ ZQeMjR ZReMjS ZSeMjT ZTeMjU ZUeMjV ZVeMjW ZWeMjX ZXeMjY ZYeMjZ ZZeMj[ Z[dS )>z< CloudLinux control panel API API for Hosting control panel � N)� lru_cache� )�CACHE_CPNAME�UNKNOWN_CP_NAME)�Feature�get_cl_feature_status_map�get_hosting_accounts_limit) �get_cp_plugin_module�detect_panel_fast�CPANEL_NAME�DIRECTADMIN_NAME� PLESK_NAME�ISPMANAGER_NAME�INTERWORX_NAME�INTEGRATED_NAME�OFFICIAL_PLUGINS)�NotSupported�NoPanelUser)�is_cl_solo_edition�CLEditionDetectionError�is_containerc �P � t t t t t t fv S )zH Is current panel has native CL support :return: True/False )�_CP_NAMEr r r r r � � ��/builddir/build/BUILDROOT/alt-python27-cllib-3.4.17-1.el8.cloudlinux.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/clcommon/cpapi/__init__.py�is_cl_supported_panelr 2 s% � � ������� � r Fc �6 � t � | � � S )z� Return list of available admin's packages :param raise_exc: hack for lvemanager :rtype: list :return: List of packages. For example ['BusinessPackage', 'Package2'] )�_panel_class�admin_packages�� raise_excs r r r @ s � � �&�&�y�1�1�1r c �4 � t � � � S )a Return dictionary, contains available resellers packages, grouped by resellers :rtype: dict :return: Dictionary. Example: {'res1': ['BusinessPackage', 'UltraPackage', 'Package'], 'res2': ['SimplePackage', 'Package'] } )r �resellers_packagesr! s r r$ r$ K s � � �*�*�,�,�,r c �� � t j � � dk rt � � � S t t t k rt � � � S t �t S t } t j � t � � rTt t d�� � 5 }|� � � � � � } ddd� � n# 1 swxY w Y | S )zC Return panel name :rtype: str :return: Panel name r Nzutf-8)�encoding)�os�getegidr � getCPNamer r �_CP_PLUGIN_NAMEr r �path�isfiler �open�readline�strip)�controlpanelname�cache_streams r r) r) W s� � � �z�|�|�q����%�%�'�'�'� ��(�O�;�;��%�%�'�'�'� � ���&�� �w�~�~�l�#�#� ?� �,�� 1� 1� 1� ?�\�+�4�4�6�6�<�<�>�>�� ?� ?� ?� ?� ?� ?� ?� ?� ?� ?� ?���� ?� ?� ?� ?��s �4'C'�'C+�.C+c �4 � t � � � S )z� Retrieve panel name and it's version :rtype: dict :return: dict: { 'name': 'panel_name', 'version': 'panel_version', 'additional_info': 'add_info'} or None if can't get info )r �get_cp_descriptionr r r r3 r3 q s � � �*�*�,�,�,r c � � t � � rt � � � S t � d�� � } d� | D � � }t |� � S )z� Generates a list of cpusers registered in the control panel :return: list of cpusers registered in the control panel :rtype: tuple )�cplogin)�keylsc � � g | ] }|d ��S )r r )�.0�user_s r � <listcomp>zcpusers.<locals>.<listcomp>� s � �4�4�4��5��8�4�4�4r )r r �cpusers�cpinfo�tuple)� users_info�_list_userss r r; r; { s[ � � ��� &��#�#�%�%�%��$�$�=�$�9�9�J�4�4��4�4�4�K�����r c �4 � t � � � S )z� Generates a list of resellers in the control panel :return: list of cpusers registered in the control panel :rtype: tuple )r � resellersr r r rA rA � s � � �!�!�#�#�#r c �4 � t � � � S )z� Generates a set of admins in the control panel :return: set of cpusers registered in the control panel :rtype: set :raise: NotSupported )r �adminsr r r rC rC � s � � ��� � � r c �4 � t � � � S )z� Getting root access to mysql database. For example {'login': 'root', 'db': 'mysql', 'host': 'localhost', 'pass': '9pJUv38sAqqW'} :return: root access to mysql database :rtype: dict :raises: NoDBAccessData )r � db_accessr r r rE rE � s � � �!�!�#�#�#r c �8 � t � | |� � S )a� Returs a list of pairs, the database user login - user login control panel For example: (('nata2_someuse', 'nata2'), ('testsome_dfrtbus', 'testsome')) :param list|tuple|None cplogin_lst: list of control panel users :param bool with_system_users: add system users to dbmapping :return: list of pairs, the database user login - user login control panel :rtype: tuple :raises: NotSupported, NoPackage )r �dblogin_cplogin_pairs)�cplogin_lst�with_system_userss r rG rG � s � � �-�-�k�;L�M�M�Mr �r5 �package�mail�reseller�dnsTc �<