Sid Gifari From Gifari Industries - BD Cyber Security Team
Home
/
opt
/
cloudlinux
/
venv
/
lib
/
python3.11
/
site-packages
/
lve_utils
/
hooks
/
__pycache__
/
✏️
Editing: domain_limits_hook.cpython-311.pyc
� �@�j� � � � d dl Z d dlZd dlZd dlmZmZ d dlmZ d dlm Z e j e� � Z G d� dee� � Z dS )� N)�ModifyDomainHook�ModifyUserHook)�lve_supported_or_exit)�registry_path_by_usernamec �z � e Zd ZdZdZe dd�� � Zed� � � Zed� � � Ze d d�� � Z dS ) �DomainLimitsHookz� Keep the LVD on-disk state (domains.json + binary id-registry) in sync with control-panel domain and user events so that per-domain limits keep working. z/usr/sbin/lvectlNc �N � t |� � sd S |p|}| j dd|d|g} |r| d|gz } |r| d|gz } t j | dd�� � } | j d k rNt � d | j | j � d�� � � � � � � d S d S ) N�regenerate-domains� --usernamez--domainz--old-domainz --old-docrootTF��capture_output�checkr z%regenerate-domains failed (rc=%d): %s�replace��errors� r �LVECTL� subprocess�run� returncode�log�warning�stderr�decode�strip)�self�username�domain� new_domain�include_subdomains�old_docroot�new_docroot�kwargs�current_domain�cmd�results �(py/lve_utils/hooks/domain_limits_hook.py�post_modify_domainz#DomainLimitsHook.post_modify_domain s� � � )��2�2� ��F�#�-�v�� �K�-��(��� �� � ,��N�F�+�+�C�� 2��O�[�1�1�C����D��F�F�F�����!�!��K�K�7��!�� �$�$�I�$�6�6�<�<�>�>� � � � � � "�!� c �" � t |� � sdS | j dd|d|g}t j |dd�� � }|j dk rNt � d |j |j � d �� � � � � � � dS dS )a� Drop the registrations the deleted domain leaves behind. Nothing else does: the registry entry is written by root, the panel never learns of it, and the single-domain regenerate path needs a docroot the panel can still resolve. Left alone the entry, its domains.json record and its kernel LVE outlive the domain, and every later `lvectl apply` reports the account as holding a registration the panel no longer lists (CLOS-7467). Nr r z--deleted-domainTFr r z;regenerate-domains after domain deletion failed (rc=%d): %sr r r )r r r r# r% r&