ok
Direktori : /opt/cloudlinux/venv/lib/python3.11/site-packages/xray/internal/__pycache__/ |
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/xray/internal/__pycache__/utils.cpython-311.pyc |
� ��f�l � �� � d Z ddlZddlZddlmZ ddlZddlZddlZddlZddl Z ddl Z ddlZddlZddl mc mZ ddlmZ ddlmZmZ ddlmZ ddlmZ ddlmZmZmZmZmZmZmZ dd l m!Z!m"Z"m#Z# ddl$Z$dd l%m&Z& ddl'm(Z( ddl)m*Z* dd l+m,Z,m-Z-m.Z.m/Z/ ddl0m1Z1 ddl2m3Z3 ddl4m5Z5 ddl6m7Z7 ddl8m9Z9 ddl:m;Z< ddl=m>Z>m?Z?m@Z@mAZAmBZBmCZC ddlDmEZEmFZF ejG d� � ZHeIeJe jK fZLde!de!fd�ZMde!de!fd�ZNde!de!fd�ZOdePfd�ZQdefd�ZRdePdefd �ZSdeTfd!�ZUd"e"eV deTfd#�ZWd"e"eV deTfd$�ZXdeTfd%�ZYe@fd&eTd'eTddfd(�ZZe@fd'eTdeTfd)�Z[deTfd*�Z[de#e\ fd+�Z]eOdeTfd,�� � Z^d-eTde#eT fd.�Z_de#eT fd/�Z`dYd0�ZaeAfd1eTde#eT fd2�Zbd3eTd4eTddfd5�Zcd6eTdd7fd8�Zdd9ePdePfd:�Zed;eTde#ef fd<�Zgd;eTde#eT fd=�ZhdZd;eTddfd>�Zid;eTde\fd?�Zjde\fd@�Zkde\fdA�ZldBe\ddfdC�Zmde\fdD�Znde\fdE�Zode\fdF�Zpd-eTde\fdG�ZqdH� Zred[dK�� � Zsed\dMeTdNe\fdO�� � Zted]dPePddfdQ�� � Zue d^dTePdUePdPePddfdV�� � ZvedW� � � ZwdX� ZxdS )_zB This module contains helpful utility functions for X-Ray Manager � N)�getuser)�contextmanager)�date� timedelta��wraps)�glob)�socket�fromfd�AF_UNIX�SOCK_STREAM� SOCK_DGRAM�AF_INET�AF_INET6)�Callable�List�Optional)�AtexitIntegration)�LoggingIntegration)�Feature)�is_panel_feature_supported�get_cp_description� getCPName�is_wp2_environment)�get_cl_edition_readable)�UIConfig)�drop_privileges)�get_rhn_systemid_value)�php_get_vhost_versions_user)�gettext� )� sentry_dsn�local_tasks_storage� agent_file� logging_level�jwt_token_location�user_agent_sock)� XRayError�XRayManagerExit�utils�func�returnc �F � �� d� �t � � � � �fd�� � }|S )zf Decorator aimed to update ini file in cagefs-skeleton Applies to task.add nd task.remove c �X � t j � | d j d� � }|� d� � r8t d� � r)t j � d|dd� � � }n�|� d� � r�t d � � r�t j � d |dd� � � }t j � t j � |� � � � s1t j t j � |� � � � ndS t j � |� � s|t j � |� � r[ t j |� � dS # t $ r7}t � d |t |� � d��� � Y d}~dS d}~ww xY wdS t j ||� � dS # t $ r7}t � d |t |� � d��� � Y d}~dS d}~ww xY w)zd Copy ini file to cagefs-skeleton Action takes place for cPanel ea-php only r zxray.iniz/opt/cpanelz/usr/share/cagefsz"/usr/share/cagefs/.cpanel.multiphpr! Nz /usr/localz/usr/share/cagefs-skeletonz'Failed to unlink ini in cagefs-skeleton)�xray_ini�err��extraz'Failed to copy ini into cagefs-skeleton)�os�path�join�ini_location� startswithr �exists�dirname�mkdir�unlink�OSError�logger�warning�str�shutil�copy)�args�original_ini�skeleton_ini�es �J/opt/cloudlinux/venv/lib64/python3.11/site-packages/xray/internal/utils.py�updatezskeleton_update.<locals>.updateH sV � � �w�|�|�D��G�$8�*�E�E���"�"�=�1�1� �d�#�7%� 7%� ��7�<�<�(L�(4�Q�R�R�(8�:� :�L�L� � $� $�\� 2� 2� �t�,�8.� 8.� ��7�<�<�(D�(4�Q�R�R�(8�:� :�L��7�>�>�"�'�/�/�,�"?�"?�@�@� 8��������6�6�7�7�7���F��w�~�~�l�+�+� 6��w�~�~�l�+�+� :�:��I�l�+�+�+�+�+��� :� :� :��N�N�#L�6B�14�Q���*9� *9� #� :� :� :� :� :� :� :� :� :�����:���� :� :� 6���L�,�7�7�7�7�7��� 6� 6� 6����H�2>�-0��V�V�&5� &5� � 6� 6� 6� 6� 6� 6� 6� 6� 6����� 6���s0 �4F � G�,G�G�G( �( H)�2,H$�$H)c �"