관리-도구
편집 파일: user_manager.cpython-311.pyc
� b��f� � �T � d Z ddlZddlZddlZddlmZ ddlmZ G d� d� � Z dS )zx This module contains class implementing part of X-Ray Manager related to User Agent management (enable/disable/status) � N)�gettext� )�XRayManagerErrorc � � e Zd ZdZd� Zed� � � Zdddd�dej fd�Z dd �Z dd edej fd�Zdd �Z dd�Zdd�ZdS )�ManageUserAgentz0 Manager actions related to user plugin c � � d| _ d| _ t j d� � | _ t t t j f| _ d S )Nzxray-user-agentzxray-user-agent.socket�user_plugin_manager) �service_name�service_socket�logging� getLogger�logger�OSError� ValueError� subprocess�SubprocessError�subprocess_errors)�selfs �Q/opt/cloudlinux/venv/lib64/python3.11/site-packages/xray/internal/user_manager.py�__init__zManageUserAgent.__init__ s? � �-���6����'�(=�>�>����Z��!;�" ����� c �@ � t j � d� � S )z- Check for systemd available �/bin/systemctl)�os�path�isfile� r r � is_systemdzManageUserAgent.is_systemd s � � �w�~�~�.�/�/�/r TF��capture_output�text�check�returnc � � t j ||||�� � }| j � dd� |� � h� � �n|# t j $ r�}| j � d|j |j |j p|j |j |j |j |j d��� � t t d� t |j � � t |j � � t |j � � pt |j � � � � � � � � �d}~w| j $ r�}| j � d d� |� � d t |� � i�� � t t d� d� |� � t |� � � � � � � � �d}~ww xY w|S )z< Call subprocess described with given *args r zCommand '%s' succeeded� z-External command '%s' failed with code %s: %s)�cmd�retcode�stdout�stderr)�extraz-External command '{}' failed with code {}: {}Nz#Failed to run '%s' external command�errz'Failed to run '{}' external command: {})r �runr �info�join�CalledProcessError�errorr&