5_|ddlZddlZddlmZmZddlmZddlmZej e Z GddeeZ dS)N)ModifyDomainHookModifyUserHook)lve_supported_or_exit)registry_path_by_usernamecNeZdZdZdZe ddZe ddZdS)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 Nt|sdS|p|}|jdd|d|g} |r| d|gz } |r| d|gz } tj| dd} | jd krNt d | j| jd  dSdS) Nregenerate-domains --usernamez--domainz --old-domainz --old-docrootTFcapture_outputcheckrz%regenerate-domains failed (rc=%d): %sreplaceerrors rLVECTL subprocessrun returncodelogwarningstderrdecodestrip) selfusernamedomain new_domaininclude_subdomains old_docroot new_docrootkwargscurrent_domaincmdresults (py/lve_utils/hooks/domain_limits_hook.pypost_modify_domainz#DomainLimitsHook.post_modify_domains )22  F#-v K- (    , NF+ +C  2 O[1 1CDFFF   ! ! KK7! $$I$66<<>>      " !c &|dSt|sdS|jdd|g}tj|dd}|jdkrNt d|j|jd  dSdS) Nr r TFr rz7regenerate-domains after user rename failed (rc=%d): %srrr)rrnew_name new_ownerr#r%r&s r'post_modify_userz!DomainLimitsHook.post_modify_user7s   F(22  F K- ( DFFF   ! ! KKI! $$I$66<<>>      " !r))NNNN)NN)__name__ __module__ __qualname____doc__rrr(r-r)r'rrss  F15*.826#'r)r) loggingrclcommon.public_hooks.librrclcommon.lib.cleditionrwebsiteisolation.id_registryr getLoggerr.rrr2r)r'r8sFFFFFFFF888888BBBBBBg!!88888'88888r)