Edit File: manager.cpython-311.pyc
� �e� � �� � d dl mZ d dl mZ d dl mZ d dlZd dlmZ d dlZd dlZd dl Z d dl mZmZ ej � ed� � ZdZ ed g d �� � Z eedz dd d� � eedz ddd� � eedz ddd� � eedz ddd� � eedz ddd� � eedz ddd� � fZ e j e� � Zd� Zd� Zd� Zd� Zefd�Zefd�ZdS )� )�absolute_import)�division)�print_functionN)� 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_installedr2 �e�messages ��/builddir/build/BUILDROOT/alt-python27-cllib-3.3.5-1.el8.cloudlinux.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/clcommon/public_hooks/bundle/cpanel/manager.py� _install_hookr; $ 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 r: r% r% A s� � � "�#�#�I����t���8�$�U�+� � �A���y�,�,�,��7��u�1D�1D��t�t�� �� � � � ��u�u������5s �)A �A � A�Ac �n � t j g d�d�� � } nL# t t j f$ r3}t � dt |� � � � Y d}~dS d}~ww xY w t j | � � }n8# t t f$ r$ t � dt � � Y dS w xY w|S )z& Reads main hooks config file )r �listz --output=JSONT)r# z>Unable to load list of already installed hooks. Reason is `%s`NzDReceived list of installed hooks is malformed and not valid JSON. %s) r) r* r/ r0 r&