관리-도구
편집 파일: manager.cpython-311.pyc
� P�Cg� � � � d dl Z d dlmZ d dlZd dlZd dlZd dlmZmZ ej � ed� � ZdZ edg d�� � Z e edz d d d� � e edz d d d� � e edz d d d� � e edz d dd� � e edz d dd� � e edz ddd� � fZ ej e� � Zd� Zd� Zd� Zd� Zefd�Zefd�ZdS )� N)� namedtuple)�CLOUDLINUX_HOOKS�CONTACT_SUPPORT_MESSAGE_FOOTERzcpanel/�"/usr/local/cpanel/bin/manage_hooks�Hook)�path�category�event�stage�postwwwacct�WhostmgrzAccounts::Create�post�postkillacctzAccounts::Remove�prekillacct�pre�postmodifyacctzAccounts::Modify� premodifyacct�postrestoreacct�PkgAcct�Restorec � � t ||| |� � }|rt � d|||� � dS t � d|||� � t j t dd| dt |� � dt |� � dt |� � d gt j d� � � }t � d|� � � � � dS # t t j f$ r�}t |t j � � r|j � d� � }nt |� � }t � d t j � | � � |t |� � |� � Y d }~dS d }~ww xY w)Nz>Hook for %s:%s:%s action is already installed; skip installingTz Registering %s:%s:%s action hook�add�script� --category�--event�--stage�--manual��stderr�textz3Register hook ended successfully; tool output: `%s`� zDCan't install hook `%s` to category: `%s` event: `%s`; message: `%s`F)�_is_hook_installed�logger�info�debug� subprocess�check_output�MANAGE_HOOK�str�STDOUT�rstrip�OSError�CalledProcessError� isinstance�output�error�osr �basename)� hook_pathr r r �is_installedr/ �e�messages ��/builddir/build/BUILDROOT/alt-python27-cllib-3.4.17-1.el8.cloudlinux.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/clcommon/public_hooks/bundle/cpanel/manager.py� _install_hookr8 ! s� � �%�e�X�y�%�H�H�L�� ���� <��e�U� ,� ,� ,� �t� �L�L�3�X�u�e�L�L�L���(����)��#�h�-�-��s�5�z�z��s�5�z�z�:� * � �#�$�0� 0� 0�� ���I�6�=�=�?�?�[�[�[��t�� �Z�2�3� � � ��a��6�7�7� ��h�o�o�d�+�+�G�G��!�f�f�G����\��W�%�%�i�0�0�(�C��J�J�� Q� Q� Q��u�u�u�u�u��������s �AC �F�/BF�Fc � � t � � }|�dS || | D ]}|d |k r|d |k r dS �n# t $ r Y dS w xY wdS )zd Check if hook with given parameters is installed in control panel :return: boolean N�hookr TF)�_get_hooks_config�KeyError)r r �hook_script_pathr � all_hooks�is r7 r"