관리-도구
편집 파일: cl_selector_arg_parse.cpython-311.pyc
� %�4g= � � � d dl mZ d dl mZ d dl mZ d dlZd dlZd dlmZ d dlmZ d dlm Z m Z mZmZm Z dd lmZ d ZdZdZd Zd� Zd� Z dd�ZdS )� )�absolute_import)�print_function)�divisionN)�docopt)� DocoptExit)�Schema�And�Use�Or�SchemaError� )�CloudlinuxSelectorLib�nodejs�python�ruby�phpc �@ � |s;t |d |d |d |d g� � rt dd� � �| t k r&t |d g� � rt dd� � �| t k r4t |d |d |d g� � rt dd� � �| t t fvrzt |d |d |d |d |d |d |d |d |d |d |d |d |d g � � rt dd� � �| t k r(|d s|d rt ddt z � � �|sBt |d |d |d |d |d g� � rt dd� � �| t k r&t |d g� � rt dd� � �| t t fv r(|d s"|s"t � � st dd!� � �dS dS dS dS )"z� Do some additional checks to restrict commands not available for current user or interpreter or whatever and do this only after args parsing �install-version�uninstall-version�enable-version�disable-versionNz2This command should be run from administrator only�change-version-multiplez)This command is supported only for NodeJS�import-applications�migrate�uninstall-modulesz)This command is supported only for Python�create�read-config�save-config�start�restart�stop�destroy�install-modules� run-scriptz4This command is supported only for NodeJS and Python�make-defaults-config�setupz%This command is supported only for %s�--selector-status�--default-version�--supported-versionsz!Specified option(s) only for root� --entry-pointzThis options(s) only for Python�getzSelector is disabled)�anyr �NODEJS�PYTHON�PHP�_run_from_admin)�interpreter�args�as_from_root�selector_statuss �W/opt/cloudlinux/venv/lib64/python3.11/site-packages/clselector/cl_selector_arg_parse.py�_ensure_command_allowedr6 s� � � � H�C�� ��� �!�� ��� �� !� � � H� ��F�H� H� H� �f����� &�'�&� "� "�� �$� K�L�L�L��f����� "�#��Y��� �!�&� "� "�� �$� K�L�L�L��6�6�*�*�*�s�� ��� ���X���]���]��� ��� �!��W� ��Y���V���Y��� ���\��4� 0� 0�*� �$� V�W�W�W��c���t�$:�;��t�G�}���$� G�#� M�N�N�N�� E�C�� #�$��W� �� �!�� �!�� #�$�!� � � E� �$� C�D�D�D��f�����_��&� "� "�� �$� A�B�B�B��v�v�&�&�&�t�E�{�&�?�&�[j�[l�[l�&��$� 6�7�7�7� '�&�&�&�&�&�&�&� c �� � t j t j � dt t j � � � � � � � � j dk S # t $ r Y dS w xY w)z� Check who is owner of the parent process. if owner is root - return True if parent process can't be found - return True :return: z/proc/r T)�os�stat�path�join�str�getppid�st_uid�OSError� r7 r5 r0 r0 [ s_ � ���w�r�w�|�|�H�c�"�*�,�,�.?�.?�@�@�A�A�H�A�M�M��� � � ��t�t����s �AA � A)�(A)FTc �z ���� d}d� |� � } t || � � �n # t $ r d}|s|d|z z }d|fcY S w xY w�� d� � ��fd�}t dt t d � � � t t t |� � � � d �� � }d� }d } t i dt �dt �dt �dt �dt �dt �dt �dt �dt �dt �dt �dt �dt �dt �dt �dt �dt �i dt �d t �d!t �d"t �d#t dt � � �d$t �d%t �d&t �dt dt t t t � � �d't �d(t �d)t �d*t �d+t �d,t dt t t |� � � � | d,z �� � �d-|�d.|��i d/t dt t d0� � � d1�� � �d2|�d3t dt t t |� � � � | d3z �� � �d4t dt t t |� � � � | d4z �� � �d5t dt � � �d6t dt � � �d7t dt � � �d8t dt � � �d9t dt � � �d:t dt � � �d;t dt � � �d<t dt t d=� � � d>�� � �d?t dt � � �d@t dt � � �dAt dt � � �dBt dt � � �dCt dt � � ��t dt � � t dt � � t dt � � t dt � � t dt � � t dt t dD� � � dE�� � t t dt � � dF��� � } ���fdG�} | � �� � �n(# t $ r}dt |� � fcY d}~S d}~ww xY w�d% s �d sdHS �� �t fv r t �d<